ARIS Community - We Love BPM

How can I change the access rigths of a group?

hreidemeister's picture
by Holger Reidemeister in Reports & Macros posted on 2017-04-25

Hello,

currently I need a script to change the access rights of a group inside a report.

With oCurrentGroup = oCurrentModel.Group() I get the group object and with mAccess = oCurrentGroup.AccessRights() I get a map of the rights. That works fine.

This maps contains the UID and a number for every entry. I guess the UID is the UID of an user or usergroup. And the number is a constant for the right the user haves. Now I could get the content in a string with mAccess.toString(), then separate the keys and a value into an array. But this cold generate problems with the type of the variables. There must be a smarter way.

In the ARIS Script helpside I found a function: mAccess.toArray(). But this line generates a TypeError: Cannot find function toArray in object ...
Also the iteration througth the map with for(var i of mAccess) generates a syntax error. I found this line in the internet.

I guess I could read of all entries by mAccess.get(key). But in this case I need all the keys. And the report must be flexible for the case, that other usergroups are generated in the database and for more then one database.

So my question is:
How can I read the keys and values of all entries in the map?
And how can I write back the changed rights into the group?

I only found the function .AccessRights() to read the map in the ARIS Script help and no function like .setAccessRights or so.

I would be very happy if anyone could help me.
Many thanks in advance.

4191 Views
0 Likes
2 Comments
Sorry there are no tags
There are no attachments
Amol Patil posted on 2017-04-25

Hi Holger,

How can I read the keys and values of all entries in the map?
Ans: The AccessRights() method of a Group return a java.util.Map. You can read the complete key set into an array using mAccess.keySet().toArray(). And then iterate it for each key to find the value using mAccess.get(key).
 
And how can I write back the changed rights into the group?
Ans: You can do a read and write of Access Rights using methods of class User and UserGroup. If you build your logic to read users and usergroups first and then read their access rights on the specific group, then you dont need to read the Access Rights map from the Group.
Check the help for User and UserGroup for more details.
 
Regards,
Amol Patil

 

Holger Reidemeister posted on 2017-04-25

Hallo Amol,

many, many thanks for your help. :-) Your second tip works fine.