Sunday, July 7, 2013

Dashboard List for specific User

What are the Dashboards list permission having for each user.

I want to show on a dashboard page  what are the dashboards list  having access in logged user.

Step 1:

I'm using a javascript in a text object in a dashboard page, which generates the list of dashboards.

Copy the below java script and go to Dashbaord--> Page--> Add Text --> paste the below code and Check the HTML option.

<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">
$.ajaxSetup({
    beforeSend:function(){
        $("#loading").show();
    },
    complete:function(){
        $("#loading").hide();
    }
});

$.ajax({
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>';
        }
    });
$('#dash_list').html(str);
});
</script>





No comments:

Post a Comment