Skip to main content
1-Visitor
February 21, 2019
Solved

Giving permission to User or Adding a User in a organization

  • February 21, 2019
  • 7 replies
  • 3332 views

Hi,

Is it possible to give design time and runtime permission to a user via java script snippets or ME?

And is it possible to add the created user in an organization via script?

Please provide some idea.

Thanks,

Shalini V.

Best answer by rosharma

@svisveswaraiya_285988 As you are assigning permissions to mashup - this entity only supports ServiceInvoke type permissions. Other property & event related permissions are denied at mashup levels. 

So only this code will work

 

var params = {
principal: "user1" /* STRING */,
allow: true /* BOOLEAN */,
resource: "*" /* STRING */,
type: "ServiceInvoke" /* STRING */,
principalType: "User" /* STRING */
};

// no return
Mashups["newMashup"].AddRunTimePermission(params);

7 replies

1-Visitor
February 21, 2019

Hi

 

Yes it is possible. For the permissions, you can execute the AddRuntimePermissions script on the entity or call the service in another service. The AddRuntimePermissions service is a generic service on the thing.

The same applies to adding a member to an organisation, just run or call the service AddMember and fill in the required inputs. The AddMember service is found on any organisation.

 

Hope that answers your question

1-Visitor
February 25, 2019

Hi @eengelbrecht,

Thanks for your response.

As you suggested I called a generic service from Entities tab to add design time permission to a mashup. But it doesnt show me any space to add the user. Should I give the username in Principal row?

var params = {
principal: undefined /* STRING */,
allow: 'true' /* BOOLEAN */,
type: undefined /* STRING */,
principalType: undefined /* STRING */
};

// no return
Mashups["TestingCalendarUpdate"].AddDesignTimePermission(params);

 

Please help me get through this.Permissions.png

16-Pearl
February 26, 2019

@svisveswaraiya_285988 

Principal here should be user 

 

like in my snippet example i am defining the design time (Update) permissions for userA 

this is the way it worked.

 

and if you are defining permissions at Group level then it should be like

principal : "testgroup"

principalType:"Group"

 

I believe this will help and if it does then mark this as solution for the beneficial for others

////////////////////////////////////////////////////////

 

var params = {
principal: "userA" /* STRING */,
allow: true /* BOOLEAN */,
type: "Update" /* STRING */,
principalType: "User" /* STRING */
};

// no return
Mashups["keyboardEvent"].AddDesignTimePermission(params);