Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Include Page
spaceKeyGrouper
pageTitleNavigation

Move and Copy Groups and Folders

...

Finally, there are several options that you can specify.  All options default to true.

API Method

Description

copyPrivilegesOfGroup(boolean)

Whether to copy the access privileges of the group.  If this option is selected, you must have READ access to all privileges.

copyGroupAsPrivilege(boolean)

Whether to copy access and naming privileges where the group is a member.  For instance, if you are copying Group X and Group X has admin privileges to Group Y, then if this option is enabled, after Group X is copied, the new group will also have admin privileges to Group Y.  If this option is selected, you must have access to add privileges to the other groups and folders.

copyListMembersOfGroup(boolean)

Whether to copy list memberships of the group.  If this option is selected and this group has custom lists, you must have read access to them.

copyListGroupAsMember(boolean)

Whether to copy list memberships where the group is a member.  For instance, if you are copying Group X and Group X is a member of Group Y, then if this option is enabled, after Group X is copied, the new group will also be a member of Group Y.  If this option is selected, you must have access to add memberships to the other groups.

copyAttributes(boolean)

Whether to copy attributes.  If this option is selected, you must have READ access to all attributes.  These are attributes that are added to GroupTypes.  This does not include attributes in the new attribute framework in v1.5.0.

Example usage in GSH

Code Block
gsh 1% help("GroupCopy")
GroupCopy help:
There is an object: GroupCopy which has various chaining methods,
which should be ended with a save() method.

GroupCopy groupCopy = new GroupCopy(group, stem)  Create a new instance.
GroupCopy groupCopy.copyPrivilegesOfGroup(boolean)  Whether to copy privileges of the group.  Default is true.
GroupCopy groupCopy.copyGroupAsPrivilege(boolean)  Whether to copy privileges where this group is a member.  Default is true.
GroupCopy groupCopy.copyListMembersOfGroup(boolean)  Whether to copy the list memberships of the group.  Default is true.
GroupCopy groupCopy.copyListGroupAsMember(boolean)  Whether to copy list memberships where this group is a member.  Default is true.
GroupCopy groupCopy.copyAttributes(boolean)  Whether to copy attributes.  Default is true.
Group groupCopy.save()  Copies the group.

 Examples:

gsh 1% new GroupCopy(group, stem).copyAttributes(false).save()

 -or- (without chaining)

gsh 2% groupCopy = new GroupCopy(group, stem);

gsh 3% groupCopy.copyAttributes(false);

gsh 4% groupCopy.save();

 -or- (if you want to use the default options)

gsh 5% group.copy(stem);

...

Finally, there's one option you can specify, which defaults to true.

API Method

Description

assignAlternateName(boolean)

Whether to assign the old name of the group as an alternate name of the group after the move.  This allows API methods like GroupFinder.findByName() to find the group using the old and new names and can make it easier to transition from the old name to the new name.

Example usage in GSH

Code Block
gsh 2% help("GroupMove")
GroupMove help:
There is an object: GroupMove which has various chaining methods,
which should be ended with a save() method.

GroupMove groupMove = new GroupMove(group, stem)  Create a new instance.
GroupMove groupMove.assignAlternateName(boolean)  Whether to add the current name of the group to the group's alternate names list.  Default is true.
void groupMove.save()  Moves the group.

 Examples:

gsh 1% new GroupMove(group, stem).assignAlternateName(false).save()

 -or- (without chaining)

gsh 2% groupMove = new GroupMove(group, stem);

gsh 3% groupMove.assignAlternateName(false);

gsh 4% groupMove.save();

 -or- (if you want to use the default options)

gsh 5% group.move(stem);

...

Finally, there are several options that you can specify.  All options default to true.

API Method

Description

copyPrivilegesOfStem(boolean)

Whether to copy the naming privileges of the folder and child folders.

copyPrivilegesOfGroup(boolean)

Whether to copy the access privileges of the child groups.

copyGroupAsPrivilege(boolean)

Whether to copy access and naming privileges where the child group is a member.  For instance, if you are copying Group X and Group X has admin privileges to Group Y, then if this option is enabled, after Group X is copied, the new group will also have admin privileges to Group Y.  If this option is selected, you must have access to add privileges to the other groups and folders.

copyListMembersOfGroup(boolean)

Whether to copy list memberships of the child groups.

copyListGroupAsMember(boolean)

Whether to copy list memberships where the child group is a member.  For instance, if you are copying Group X and Group X is a member of Group Y, then if this option is enabled, after Group X is copied, the new group will also be a member of Group Y.  If this option is selected, you must have access to add memberships to the other groups.

copyAttributes(boolean)

Whether to copy attributes. These are attributes that are added to GroupTypes.  This does not include attributes in the new attribute framework in v1.5.0.

Example usage in GSH

Code Block
gsh 4% help("StemCopy")
StemCopy help:
There is an object: StemCopy which has various chaining methods,
which should be ended with a save() method.

StemCopy stemCopy = new StemCopy(stemToCopy, destinationStem)  Create a new instance.
StemCopy stemCopy.copyPrivilegesOfStem(boolean)  Whether to copy privileges of stems.  Default is true.
StemCopy stemCopy.copyPrivilegesOfGroup(boolean)  Whether to copy privileges of groups.  Default is true.
StemCopy stemCopy.copyGroupAsPrivilege(boolean)  Whether to copy privileges where groups are a member.  Default is true.
StemCopy stemCopy.copyListMembersOfGroup(boolean)  Whether to copy the list memberships of groups.  Default is true.
StemCopy stemCopy.copyListGroupAsMember(boolean)  Whether to copy list memberships where groups are a member.  Default is true.
StemCopy stemCopy.copyAttributes(boolean)  Whether to copy attributes.  Default is true.
Stem stemCopy.save()  Copies the stem.

 Examples:

gsh 1% new StemCopy(stemToCopy, destinationStem).copyAttributes(false).save()

 -or- (without chaining)

gsh 2% stemCopy = new StemCopy(stemToCopy, destinationStem);

gsh 3% stemCopy.copyAttributes(false);

gsh 4% stemCopy.save();

 -or- (if you want to use the default options)

gsh 5% stem.copy(destinationStem);

...

Finally, there's one option you can specify, which defaults to true.

API Method

Description

assignAlternateName(boolean)

Whether to assign the old name of the groups in the folder as an alternate name of the groups after the move.  This allows API methods like GroupFinder.findByName() to find the groups using the old and new names and can make it easier to transition from the old name to the new name.

Example usage in GSH

Code Block
gsh 3% help("StemMove")
StemMove help:
There is an object: StemMove which has various chaining methods,
which should be ended with a save() method.

StemMove stemMove = new StemMove(stemToMove, destinationStem)  Create a new instance.
StemMove stemMove.assignAlternateName(boolean)  Whether to add the current names of the affected groups to the groups' alternate names list.  Default is true.
void stemMove.save()  Moves the stem.

 Examples:

gsh 1% new StemMove(stemToMove, destinationStem).assignAlternateName(false).save()

 -or- (without chaining)

gsh 2% stemMove = new StemMove(stemToMove, destinationStem);

gsh 3% stemMove.assignAlternateName(false);

gsh 4% stemMove.save();

 -or- (if you want to use the default options)

gsh 5% stem.move(destinationStem);

Grouper UI screenshot

Web Services Approach

It is also possible to use web services to move groups from one stem to another. Here is sample code

POST /grouper-ws/servicesRest/v2_2_000/groups

{

  "WsRestGroupSaveRequest":

  {

    "wsGroupToSaves":

    [

      {

        "wsGroup":

        {

          "name":"UDL:ACT:PROJ:PROJ:test_ss_dossier:GT-REFIDENTNUM"

        },

        "wsGroupLookup":

        {

          "groupName":"UDL:ACT:PROJ:test_ss_dossier:GT-REFIDENTNUM"

        }

      }

    ],

    "params":

    [

      {

        "paramName":"moveOrCopy",

        "paramValue":"move"

      },

      {

        "paramName":"moveOrCopyToStemName",

        "paramValue":"UDL:ACT:PROJ"

      }

    ]

  }

}




...