热门关键字:  ubuntu  分区  函数  Fedora  linux系统进程

sybase角色分层和互斥

来源: 作者: 时间:2007-09-14 Tag: 点击:

5、 增加登录用户lg2用于测试

sp_addlogin "lg2","okokok"

sp_role "grant","sa_role","lg2"(需要sa_role角色的用户)

sp_role "grant","sso_role","lg2"(需要sso_role角色的用户)

6、 查看lg2用户的信息

sp_displaylogin lg2

以lg2登录,查看当前用户激活的角色

select show_role() //任何用户可以使用该命令查看当前登录用户激活的系统角色

执行结果:

sa_role

或使用sp_activeroles命令,任何用户要查看当前登录到adaptive server时所激活的所有角色信息可使用该命令

sp_activeroles

执行结果:

role name

---------

sa_role

7、使用set role命令准备激活sso_role

set role sso_role on

显示提示信息:

server message: number 11150, severity 16

line 1:

operation failed. role ''sso_role'' is mutually exclusive at membership or activation level with role ''sa_role''. remove the exclusivity and try again.

8、若要激活另一活动排斥的角色需先关闭当前角色,然后再将新角色激活。

set role sso_role off

set role sa_role on

【实验三】角色分层

1、创建一个登录用户

sp_addlogin "lg3","okokok"

2、创建角色

create role author_role

create role commtentator_role

create role editor_role

create role chief_editor_role

3、角色分层(当给一个角色授予另一个角色后,即产生角色分层)

grant role author_role to editor_role

grant role commtentator_role to editor_role

grant role editor_role to chief_editor_role

注意:不能把一个角色授予另一个已经直接包含该角色的角色

grant role author_role to editor_role

显示提示信息:

server message: number 11107, severity 10

line 1:

all the roles specified to be granted in the grant role statement have already been granted to grantee ''editor_role''.

注意:可以给一个角色授予另一个已间接包含该角色的角色

grant role author_role to chief_editor_role

注意:不能给一个角色授予一个包含该角色的角色

grant role chief_editor_role to commtentator_role

执行结果:

server message: number 11104, severity 16

line 1:

cannot grant the role ''chief_editor_role'' to role ''commtentator_role'' because it will result in cycle.

4、查看角色分层

select role_contain("commtentator_role","chief_editor_role")

返回值为1

最新评论共有 4 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册