Show TOC

Editing Group AttributesLocate this document in the navigation structure

Prerequisites

You have imported the required interfaces and gotten the required factories.

More information: User Management Functions for Groups .

Context

This procedure describes how to edit a group attribute programmatically. Use this procedure if you cannot use the existing user administration tools to perform group modification and need to customize your tools to edit groups programmatically.

Procedure

  1. Use the IRole interface to get the group object.
  2. Use the getUniqueID() method to get the unique ID of the group.
  3. Use the isPrincipalAttributeModifiable() method to determine if the attributes you want to change are read-only.
  4. Use the getMutableGroup() method to get a modifiable version of the group object.
  5. Use the setAttribute() method to set the attribute.
  6. Commit your changes.

Example

This example gets the unique ID of the group demo_group. The class then gets the role and changes the value of the attribute myAttributeName in the namespace com.example to myValue .

            public static void modifyGroup_additionalAttribute(String groupUniqueName,
                String nameSpace, String attributeName, String myValue) {

        try {

                // Get the group.

                


                // Get the unique ID

                


                // Check if the attribute is read-only or read-write.

                

                                


                        // Get a modifiable group object from the UME.

                        


                        /*
                         * Set the attribute value. 
                         * 
                         * Note: The attribute value must not exceed 255 characters. 
                         * The value of unique name must not exceed 200 characters.
                         */

                        

                                        


                        // Write the changes to the database.

                        

                        

                                                
                } else {
                        // TODO: Handle attribute is not modifiable.
                }
        } catch (NoSuchGroupException nsgex) {
                // TODO: Handle NoSuchGroupException.
        } catch (UMException umex) {
                // TODO: Handle UMException
        } catch (UMRuntimeException umrex) {
                // TODO: Handle UMRuntimeException
        }

}