FirebirdSQL logo

Who Can Create a Role

The CREATE ROLE statement can be executed by:

  • Administrators

  • Users with the CREATE ROLE privilege

    • Setting system privileges also requires the system privilege CREATE_PRIVILEGED_ROLES

The user executing the CREATE ROLE statement becomes the owner of the role.

CREATE ROLE Examples

Creating a role named SELLERS
CREATE ROLE SELLERS;
Creating a role SELECT_ALL with the system privilege to select from any selectable object
CREATE ROLE SELECT_ALL
  SET SYSTEM PRIVILEGES TO SELECT_ANY_OBJECT_IN_DATABASE;

docnext count = 6

ALTER ROLE

Alters a role

Available in

DSQL

Syntax
ALTER ROLE rolename
 { SET SYSTEM PRIVILEGES TO <sys_privileges>
 | DROP SYSTEM PRIVILEGES
 | {SET | DROP} AUTO ADMIN MAPPING }

<sys_privileges> ::=
  !! See [fblangref50-security-role-create] !!
Table 1. ALTER ROLE Statement Parameter
Parameter Description

rolename

Role name;specifying anything other than RDB$ADMIN will fail

sys_privilege

System privilege to grant

ALTER ROLE can be used to grant or revoke system privileges from a role, or enable and disable the capability for Windows Administrators to assume administrator privileges automatically when logging in.

This last capability can affect only one role: the system-generated role RDB$ADMIN.

For details on auto admin mapping, see AUTO ADMIN MAPPING.

It is not possible to selectively grant or revoke system privileges.Only the privileges listed in the SET SYSTEM PRIVILEGES clause will be available to the role after commit, and DROP SYSTEM PRIVILEGES will remove all system privileges from this role.

Who Can Alter a Role

The ALTER ROLE statement can be executed by:

  • Administrators

  • Users with the ALTER ANY ROLE privilege, with the following caveats

    • Setting or dropping system privileges also requires the system privilege CREATE_PRIVILEGED_ROLES

    • Setting or dropping auto admin mapping also requires the system privilege CHANGE_MAPPING_RULES

ALTER ROLE Examples

Drop all system privileges from a role named SELECT_ALL
ALTER ROLE SELLERS
  DROP SYSTEM PRIVILEGES;
Grant a role SELECT_ALL the system privilege to select from any selectable object
ALTER ROLE SELECT_ALL
  SET SYSTEM PRIVILEGES TO SELECT_ANY_OBJECT_IN_DATABASE;

DROP ROLE

Drops a role

Available in

DSQL, ESQL

Syntax
DROP ROLE rolename

The statement DROP ROLE deletes an existing role.It takes a single argument, the name of the role.Once the role is deleted, the entire set of privileges is revoked from all users and objects that were granted the role.

Who Can Drop a Role

The DROP ROLE statement can be executed by:

  • Administrators

  • The owner of the role

  • Users with the DROP ANY ROLE privilege

DROP ROLE Examples

Deleting the role SELLERS
DROP ROLE SELLERS;