add_user_to_role

The add_user_to_role operator lets you add a user account to one or more roles.  Available only in the Enterprise Edition.

SciDB security mode must be correctly configured before this or any security operator can be used.  See the Security section of the SciDB Administration Guide.

Synopsis

add_user_to_role('userName', 'roleName' [, 'roleName2' ...])

Summary

The add_user_to_role operator lets you add a user account to one or more roles.  Requires operator or admin privilege.

Inputs

All input parameters are string literals.

  • userName:  The name of the user to to add.
  • roleName:   The name of a role whose membership is modified to include the user.

Example

$ iquery --auth-file <admin_login_authentication_file> -a
AFL% create_user('John', 'john_password');      -- You can't log in as this user, since 'john_password' is not a valid hash.
AFL% create_role('Engineering');                -- Create a new role called Engineering
AFL% create_role('Sales');                      -- Create a new role called Sales
AFL% add_user_to_role('John', 'Engineering', 'Sales');    -- Add John to both Engineering and Sales transactionally
AFL% show_roles_for_user('John');               -- Show John's roles.  A user always belongs to a role with the same name as the user.
{No} role,id
{0} 'John',1431
{1} 'Engineering',1432
{2} 'Sales',1433
AFL% drop_role_for_user('John', 'Engineering', 'Sales');  -- Cleanup... remove John's roles
AFL% drop_role('Engineering');                            -- Remove the Engineering role
AFL% drop_role('Sales');                                  -- Remove the Sales role
AFL% drop_user('John');                                   -- Remove user John
AFL% quit;                                                -- Exit to shell
$