使用管理员选项向角色授予权限与使用管理员选项向用户授予角色?
Grant privilege to role with admin option Vs Grant role to user with admin option?
我对以下两个案例有点困惑,虽然我知道结果但我不太相信背后的原因。需要数据库专家的帮助。
(假设)角色 ROLE1 与 USER1 和 USER2 一起由 dba
创建
connect /as sysdba
create user USER1 identified by xyz;
create user USER2 identified by abc;
create role ROLE1;
案例 1:
“select 任何 table”权限被授予 ROLE1,没有管理员选项
connect /as sysdba
grant select any table to ROLE1;
使用管理员选项将 ROLE1 授予 USER1
connect /as sysdba
grant ROLE1 to USER1 with admin option;
USER1 现在可以向其他用户授予 'select any privilege' 权限吗?
connect USER1/xyz
grant select any table to USER2;
我这里报了ORA-01031: insufficient privileges错误,说明方法不对。
案例 2:
“select 任何 table”权限已授予 ROLE1 管理员选项
connect /as sysdba
grant select any table to ROLE1 with admin option;
将 ROLE1 授予 USER1,无论您是通过 w/o 管理员选项授予它
connect /as sysdba
grant ROLE1 to USER1;
USER1 现在可以向其他用户授予 'select any privilege' 权限吗?
connect USER1/xyz
grant select any table to USER2;
这很完美,没有报告任何错误。
任何人都可以帮助理解为什么 CASE2 有效而为什么 CASE1 无效?
案例 1:
grant ROLE1 to USER1 with admin option;
意味着您可以将 ROLE1
授予其他用户,无论已授予 ROLE1
什么。因此 grant select any table to USER2;
不起作用。
但是,grant ROLE1 to USER2;
应该可以。
案例 2:
您获得许可(通过角色 ROLE1
,就像 DBA
角色获得它一样)将 select any table
授予其他用户。所以,grant select any table to USER2;
有效。
另一方面 grant ROLE1 to USER2;
应该会失败。
我对以下两个案例有点困惑,虽然我知道结果但我不太相信背后的原因。需要数据库专家的帮助。
(假设)角色 ROLE1 与 USER1 和 USER2 一起由 dba
创建connect /as sysdba
create user USER1 identified by xyz;
create user USER2 identified by abc;
create role ROLE1;
案例 1:
“select 任何 table”权限被授予 ROLE1,没有管理员选项
connect /as sysdba grant select any table to ROLE1;
使用管理员选项将 ROLE1 授予 USER1
connect /as sysdba grant ROLE1 to USER1 with admin option;
USER1 现在可以向其他用户授予 'select any privilege' 权限吗?
connect USER1/xyz grant select any table to USER2;
我这里报了ORA-01031: insufficient privileges错误,说明方法不对。
案例 2:
“select 任何 table”权限已授予 ROLE1 管理员选项
connect /as sysdba grant select any table to ROLE1 with admin option;
将 ROLE1 授予 USER1,无论您是通过 w/o 管理员选项授予它
connect /as sysdba grant ROLE1 to USER1;
USER1 现在可以向其他用户授予 'select any privilege' 权限吗?
connect USER1/xyz grant select any table to USER2;
这很完美,没有报告任何错误。
任何人都可以帮助理解为什么 CASE2 有效而为什么 CASE1 无效?
案例 1:
grant ROLE1 to USER1 with admin option;
意味着您可以将 ROLE1
授予其他用户,无论已授予 ROLE1
什么。因此 grant select any table to USER2;
不起作用。
但是,grant ROLE1 to USER2;
应该可以。
案例 2:
您获得许可(通过角色 ROLE1
,就像 DBA
角色获得它一样)将 select any table
授予其他用户。所以,grant select any table to USER2;
有效。
另一方面 grant ROLE1 to USER2;
应该会失败。