Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: rupertkiwi on May 02, 2018, 12:21:25 pm

Title: Restrict specific scripts based on which group a user belongs to
Post by: rupertkiwi on May 02, 2018, 12:21:25 pm
Is it possible to restrict specific scripts based on which group a user belongs to?

In a similar way that diagrams or packages can be locked depending on which group a user is a member of?

I can restrict the running and editing of all scripts based on a user's group via the Security Group settings but it would be good to restrict individual scripts

Thanks,
Rupert
Title: Re: Restrict specific scripts based on which group a user belongs to
Post by: Geert Bellekens on May 02, 2018, 03:47:07 pm
Hi Rupert,

Not out of the box, but you can of course test the current user in your script yourself, and refuse to execute if she doesn't meet your requirements.

Geert
Title: Re: Restrict specific scripts based on which group a user belongs to
Post by: rupertkiwi on May 02, 2018, 04:05:58 pm
OK, thanks Geert for your prompt reply.

I will have a play around and see how I go

Cheers,
Rupert
Title: Re: Restrict specific scripts based on which group a user belongs to
Post by: Mauricio Moya (Arquesoft) on May 03, 2018, 04:41:12 am
Use the following function in JScript-type script and validate it in the logic of your script:

Code: [Select]
function isUserInGroup(groupGUID) {
var userGUID = Repository.GetCurrentLoginUser(true);
var result = DBGetFieldValueArrayString("GroupID", "t_secusergroup", "UserID = '" + userGUID + "' AND GroupID = '" + groupGUID + "'");
if(result.length == 0) {
return false;
}
return true;
}