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.
Solved! Go to Solution.
@svisveswaraiya 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);
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
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.
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);
If one of the previous responses answered your question, please mark the appropriate one as the Accepted Solution for the benefit of others with the same question.
Regards.
--Sharon
Hi rosharma,
Your response for designtime permissions worked perfectly. But for runtime permission it throws me error when I give "Property Read" / "Property Write". What should I give in the resource and type of runtime permission source code?
Thanks in advance,
Shalini V
@svisveswaraiya 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);
If you have found a solution to your issue, please post it here and mark it as the Accepted Solution. Or if one of the previous replies allowed you to resolve it, please mark the appropriate one as the Accepted Solution.
Regards.
--Sharon