Returns information about whether the user has been granted the specified role.
has_role ("role_name"[, 0])
is the name of a system or user-defined role.
is an optional parameter that suppresses auditing.
Creates a procedure to check if the user is a System Administrator:
create procedure sa_check as if (has_role("sa_role", 0) > 0) begin print "You are a System Administrator." return(1) end
Checks that the user has been granted the System Security Officer role:
select has_role("sso_role", 0)
Checks that the user has been granted the Operator role:
select has_role("oper_role", 0)
has_role functions the same way proc_role does. Beginning with Adaptive Server version 15.0, Sybase supports—and recommends—that you use has_role instead of proc_role. You need not, hoever, convert all of your existing uses of proc_role to has_role.
has_role, a system function, checks whether an invoking user has been granted, and has activated, the specified role.
has_role returns 0 if the user has:
Not been granted the specified role
Not been granted a role which contains the specified role
Been granted, but has not activated, the specified role
has_role returns 1 if the invoking user has been granted, and has activated, the specified role.
has_role returns 2 if the invoking user has a currently active role, which contains the specified role.
For general information about system functions, see “System functions”.
ANSI SQL – Compliance level: Transact-SQL extension.
Any user can execute has_role.
Commands alter role, create role, drop role, grant, set, revoke
Functions mut_excl_roles, role_contain, role_id, role_name, show_role
Copyright © 2005. Sybase Inc. All rights reserved. |