I want to update the group name of a group from old to new.
Also the configuration path in Authorizations need to be updated to the new path.
Please let me know how that needs to be done through script.
To update a group name:
groovy:
def someGroup = system.groupManager.get("group name");
someGroup.setName("new name");
system.groupManager.save(someGroup);
You do not need to update authorized configurations when changing group name, as authorizations are associated with group id which will not affected by group renaming.
I have such a system that if I rename group name then I have to also update the configuration path in group authorization
Like if in authorizations the path was
A/B/C/OLD_NAME
then if I rename the group name to NEW_NAME the corresponding authorization path should also be renamed like below
A/B/C/NEW_NAME
Then it can be done via below script:
groovy:
import com.pmease.quickbuild.persistence.*;
SessionManager.openSession();
try {
def group = system.groupManager.get("some group");
for (authorization in group.authorizations) {
authorization.configuration.setName("new name");
system.configurationManager.save(authorization.configuration);
}
} finally {
SessionManager.closeSession();
}
Since you also want to change name of related authorized configurations of the group, this statement saves the configuration after changing its name.