Creating a privilege set

A privilege set is represented by the class DKPrivilegeSetICM.

About this task

Before you can begin creating privilege sets, you must be connected to a content server. To create a privilege set, complete the following steps:

Creating a privilege set: Example

Procedure

  1. Create new privileges (or retrieve privileges) to add to the new privilege set.
    DKPrivilegeICM priv_1 = new DKPrivilegeICM(ds);
    priv_1.setName("ItemCheckOut");
    DKPrivilegeICM priv_2 = new DKPrivilegeICM(ds);
    priv_2.setName("ItemQuery");
    DKPrivilegeICM priv_3 = new DKPrivilegeICM(ds);
    priv_3.setName("ItemAdd");
  2. Create a new privilege set.
    DKPrivilegeSetICM privSet1 = new DKPrivilegeSetICM(ds);
  3. Assign a name to the privilege set.
    privSet1.setName("UserPrivSet");
  4. Assign a description to the privilege set.
    privSet1.setDescription("This is a user-defined priv set");
  5. Set the privilege set owner.
    privSet1.setOwner("user1");
  6. Set the privilege set application name.
    privSet1.setApplicationName("AppName2");
  7. Set the privilege set type.
    privSet1.setType(DKPrivilegeSetICM.DK_ICM_PRIVILEGESET_TYPE.USER);
  8. Set the privilege set scope ID.
    privSet1.setScopeID(2);
  9. Add the privileges to the privilege set.
    privSet1.addPrivilege(priv_1);
    privSet1.addPrivilege(priv_2);
    privSet1.addPrivilege(priv_3);
  10. Add the newly created privilege set to the authorization manager.
    AclMgmt.add(privSet1);
  11. Display information about the newly created privilege set.
    DKPrivilegeSetICM aPrivSet = (DKPrivilegeSetICM)
            aclMgmt.retrievePrivilegeSet("UserPrivSet");
    System.out.println("privilege set name = " + aPrivSet.getName());
    System.out.println("privilege set description=" + 
      aPrivSet.getDescription());
    dkCollection coll = aPrivSet.listPrivileges();
    dkIterator iter = coll.createIterator();
    while (iter.more()) {
       DKPrivilegeICM _priv = (DKPrivilegeICM) iter.next();
       System.out.println("  privilege name = " + _priv.getName());
    }
    Note: In IBM Content Manager 8.5 and later, both administrative or user privilege sets have AppName, Owner, Type, ScopeID properties. AppName has maximum variable length is 128. See other update references:
    • ICMSTAccessCodes (Access Control List Code Table): See system table..
    • ICMSTPrivSetCodes (Privilege Set Code Table): See system table..
    • ICMSTAccessLists (Access Control List Table): has new Index. See system table..