cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

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

pcheah
8-Gravel

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

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 2
yfilke
1-Newbie
(To:pcheah)

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;

pcheah
8-Gravel
(To:pcheah)

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

Top Tags