Tuesday, July 9, 2013

Display a list of dashboards based on permissions?

Hi Friends,

Today  an  interesting question was asked and it is answered on OTN.

Credit goes to   MTache  for his Java script on OTN forums and I am just posting it here.

Question :

Is there a way to display a list of dashboards based on permissions?

Ans :  Copy and paste the below script in the text box and mark  " Contains HTML" box. 

<img id="loading" src="/analytics/res/sk_blafp/catalog/loading-indicator-white.gif" />
<div id="dash_list"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script type="text/javascript">
url: "saw.dll?getDashboardList"
}).done(function( data ) {
    var start = data.indexOf('[');
    var end = data.lastIndexOf(']');
    var len = end-start+1;
    var json_str = data.substr(start,len);
    var json_obj = jQuery.parseJSON(json_str);
    var str = 'You have access to the following dashboards:<br/>';
    $.each(json_obj, function() {
        if (this.folderName!=='Welcome'){
            str += '<div style="float:left;margin:5px 10px;";><b>' + this.folderName + '</b><br/>';
            $.each(this.portals, function() {
                    str += '<a href="saw.dll?Dashboard&PortalPath=' + this.portalPath + '">' + this.portalName + '</a><br/>';
            str += '</div>';


No comments:

Post a Comment