Skip to main content
10-Marble
October 9, 2015
Question

View list of Things that set as RunTime or DesignTime Permission for a user

  • October 9, 2015
  • 2 replies
  • 1100 views

Lets say, I have set ThingA, ThingB, ThingC for Runtime Permission for UserA, how do I view the list of Things that has been set as RunTime Permission for this user?

    2 replies

    1-Visitor
    October 12, 2015

    Hi,

    I think there is no opportunity to get this information by default. I created a service meeting your requirements.

    Notice: To run this service you need a parameter 'User' as input (Type: USERNAME)

    var params = {

        infoTableName: infoTable1 /* STRING */

    };

    // result: INFOTABLE

    var infoTable1 = Resources["InfoTableFunctions"].CreateInfoTable(params);

    var newField = new Object();

    newField.name = 'Thingname';

    newField.baseType = 'STRING';

    infoTable1.AddField(newField);

    var newField = new Object();

    newField.name = 'User';

    newField.baseType = 'STRING';

    infoTable1.AddField(newField);

    var params = {

        maxItems: undefined /* NUMBER */,

        nameMask: undefined /* STRING */,

        type: 'Thing' /* STRING */,

        tags: undefined /* TAGS */

    };

    // result: INFOTABLE dataShape: RootEntityList

    var infoTable2 = Resources["EntityServices"].GetEntityList(params);

    for (i=0;i<infoTable2.length;i++){

        // result: INFOTABLE dataShape: Permissions

        var infoTable3 = Things[infoTable2.name].GetRunTimePermissions();

                for (z=0;z<infoTable3.length;z++){

                    if(infoTable3.name == User)

                    {

                        var newRow = new Object();

                        newRow.Thingname = infoTable2.name;

                        newRow.User = infoTable3.name;

                        infoTable1.AddRow(newRow);

                        break;

                    }

        }

    }

    var result = infoTable1;

    pcheah10-MarbleAuthor
    10-Marble
    October 13, 2015

    Thanks Yannick. I will try and let you know the outcome.