DB2 Version 9.7 for Linux, UNIX, and Windows

Delegating role maintenance by using the WITH ADMIN OPTION clause

Using the WITH ADMIN OPTION clause of the GRANT (Role) SQL statement, the security administrator can delegate the management and control of membership in a role to someone else.

The WITH ADMIN OPTION clause gives another user the authority to grant membership in the role to other users, to revoke membership in the role from other members of the role, and to comment on a role, but not to drop the role.

The WITH ADMIN OPTION clause does not give another user the authority to grant WITH ADMIN OPTION on a role to another user. It also does not give the authority to revoke WITH ADMIN OPTION for a role from another authorization ID.

Example demonstrating use of the WITH ADMIN OPTION clause

  1. A security administrator creates the role, DEVELOPER, and grants the new role to user BOB using the WITH ADMIN OPTION clause:
    CREATE ROLE DEVELOPER
    GRANT ROLE DEVELOPER TO USER BOB WITH ADMIN OPTION
  2. User BOB can grant membership in the role to and revoke membership from the role from other users, for example, ALICE:
    GRANT ROLE DEVELOPER TO USER ALICE	
    REVOKE ROLE DEVELOPER FROM USER ALICE	
  3. User BOB cannot drop the role or grant WITH ADMIN OPTION to another user (only a security administrator can perform these two operations). These commands issued by BOB will fail:
    DROP ROLE DEVELOPER  - FAILURE! 
                         - only a security administrator is allowed to drop the role
    GRANT ROLE DEVELOPER TO USER ALICE WITH ADMIN OPTION	- FAILURE! 
                         - only a security administrator can grant WITH ADMIN OPTION
  4. User BOB cannot revoke role administration privileges (conferred by WITH ADMIN OPTION) from users for role DEVELOPER, because he does not have security administrator (SECADM) authority. When BOB issues the following command, it fails:
    REVOKE ADMIN OPTION FOR ROLE DEVELOPER FROM USER SANJAY - FAILURE! 
  5. A security administrator is allowed to revoke the role administration privileges for role DEVELOPER (conferred by WITH ADMIN OPTION) from user BOB , and user BOB still has the role DEVELOPER granted:
    REVOKE ADMIN OPTION FOR ROLE DEVELOPER FROM USER BOB
    Alternatively, if a security administrator simply revokes the role DEVELOPER from user BOB, then BOB loses all the privileges he received by being a member of the role DEVELOPER and the authority on the role he received through the WITH ADMIN OPTION clause:
    REVOKE ROLE DEVELOPER FROM USER BOB