2 Replies Latest reply on Oct 13, 2015 2:52 AM by pcheah RSS
    pcheah Explorer

    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?

      • Re: View list of Things that set as RunTime or DesignTime Permission for a user
        yfilke Newbie

        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[i].name].GetRunTimePermissions();

         

         

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

         

         

                        if(infoTable3[z].name == User)

                        {

                            var newRow = new Object();

                            newRow.Thingname = infoTable2[i].name;

                            newRow.User = infoTable3[z].name;

         

         

                            infoTable1.AddRow(newRow);

                            break;

                        }

            }

        }

        var result = infoTable1;

        • Re: View list of Things that set as RunTime or DesignTime Permission for a user
          pcheah Explorer

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