AS

Hello, I know we can set an UserGroup AccessRights with the method SetAccessRights.

But can i do the same from  a Group? I noticed the method does not exist for groups.

I am trying to do a script that changes the AccessRights of a usergroup to a specific group.

The reason for this is because i am pretty much "cloning" the access rights from a Old DB to a New DB, using an excel where i only have the old GUIDs of usergroups and the new GUIDS of the new usergroups.

When I run the script I always need to choose a Main Group from a DB.

I do try to use inherit to change the access rights of the groups but in the end I am just changing the Main.

Please tell me if there an easier way to change AccessRights of Groups.

 

by M. Zschuckelt
Posted on Sun, 10/09/2016 - 22:30

Hello Ana,

have you considered the method

inheritAccessRights ( )

of the Group object? It propagates all access rights from the group to its sub-groups. Note that this is different from what you do in the client, when you select a specific user's (or user group's) permission and inherit that to the sub-groups.

Do I understand correctly that the target DB is a copy (backup&restore) of the source DB in a different environment (with different user and user group GUIDs)? What you can be sure of in that case is, that the GUIDs of the groups in the source and target DBs are identical (including the main group). So if you have a mapping of the source and target GUIDs of the users and user groups, it should be possible to create a list of all groups and their user permissions (method AccessRights) and use that to create the same permissions in the target environment for the mapped user and user group GUIDs.

Using a permission inheritance scheme always bears the risk of overlooking/overwriting  deviating permissions downwards in the group hierarchy.

Regards, M. Zschuckelt

0
by Ana Sequeira Author
Posted on Tue, 10/11/2016 - 11:39

Hey M.Zschuckelt

Thank you a lot for answering, I did try to use inheritAccessRights(), but turns out the answer was simpler then what I thought. I was somehow thinking that SetAccessRights could only be used to change the usergroup access, only a group at the time when you run it (the main group) but turns out, you can just make a loop on the groups array and like that you can change all the usergroup's access rights to the groups while also looping through the excell. I couldn't use setAccessRights properly before because of the contants value and that was the main problem. I will let that information here and how I solved it:

        for(var i = 0; i < userGroupsList.length; i++){

            for(var j = 0; j < foldersList.length; j++){ 

                if(OldGuid_Excel.lastElement() == userGroupsList[i].GUID()){

                    var right = userGroupsList[i].AccessRights(foldersList[j]);

                    for(var n = 0; n < userGroupsList.length; n++){

                        if(NewGuid_Excel.lastElement() == userGroupsList[n].GUID()){

                           if(right == 0){

                                var resNR = userGroupsList[n].SetAccessRights( [foldersList[j]] , Constants.AR_NORIGHTS);

                                //Mudar direito para NO_RIGHTS

                            }else{

                                if(right == 1){

                                    var resR = userGroupsList[n].SetAccessRights( [foldersList[j]] , Constants.AR_READ);

                                    //Mudar direito para AR_READ

                                }else{

                                    if(right == 3){

                                        var resW = userGroupsList[n].SetAccessRights( [foldersList[j]] , Constants.AR_WRITE);

                                        //Mudar direito para AR_WRITE

                                    }else{

                                        if(right == 7){

                                            var resCH = userGroupsList[n].SetAccessRights( [foldersList[j]] , Constants.AR_CHNG);

                                            //Mudar direito para AR_CHNG

                                        }else{

                                            if(right == 135){

                                                var resCH = userGroupsList[n].SetAccessRights( [foldersList[j]] , Constants.AR_READ_SUBMIT_WRITE_DELETE);

                                            }else{

                                                if(right == 128){

                                                    var resCH = userGroupsList[n].SetAccessRights( [foldersList[j]] , Constants.AR_SUBMIT);

                                                }else{

                                                    if(right == 129){

                                                        var resCH = userGroupsList[n].SetAccessRights( [foldersList[j]] , Constants.AR_READ_SUBMIT);

                                                    }else{

                                                        if(right == 131){

                                                            var resCH = userGroupsList[n].SetAccessRights( [foldersList[j]] , Constants.AR_READ_SUBMIT_WRITE);

                                                        }

                                                    }

                                                }

                                            }    

                                        }

                                    }      

                                }

                            }

                            var resFinal = userGroupsList[i].SetAccessRights( [foldersList[j]] , Constants.AR_NORIGHTS);

                        }

                    }

                }

            }

           

        }

        row++;

        isFilledRow = dataSheet.cell(row, 0).getCellValue().trim().length()>0;

    }

 

0

Featured achievement

Rookie
Say hello to the ARIS Community! Personalize your community experience by following forums or tags, liking a post or uploading a profile picture.
Recent Unlocks

Leaderboard

|
icon-arrow-down icon-arrow-cerulean-left icon-arrow-cerulean-right icon-arrow-down icon-arrow-left icon-arrow-right icon-arrow icon-back icon-close icon-comments icon-correct-answer icon-tick icon-download icon-facebook icon-flag icon-google-plus icon-hamburger icon-in icon-info icon-instagram icon-login-true icon-login icon-mail-notification icon-mail icon-mortarboard icon-newsletter icon-notification icon-pinterest icon-plus icon-rss icon-search icon-share icon-shield icon-snapchat icon-star icon-tutorials icon-twitter icon-universities icon-videos icon-views icon-whatsapp icon-xing icon-youtube icon-jobs icon-heart icon-heart2 aris-express bpm-glossary help-intro help-design Process_Mining_Icon help-publishing help-administration help-dashboarding help-archive help-risk icon-knowledge icon-question icon-events icon-message icon-more icon-pencil forum-icon icon-lock