zoukankan      html  css  js  c++  java
  • Managing Roles

    image

    image

    角色是 privilege 合 单纯的privilege使用不方便。( 可以包括 system, object privilege, roles )

    image

    image

    Improved performance ( 另一个好处 )

    Dynamic : 一改全改,比如改变 role 里的部分权限,那么所有拥有该 role的user全部更改

    avilability: 因为 role 有enable和 disbale, 所以,更加可靠。

    image

    你要有 create role 的 system privilege 。

    image

    image

    image

    image

    image

    image

    查询角色中有哪些内容,包含3方面信息( system privilege, object priviege, roles ) --所以要查看3个数据字典

    role_role_privs  --查看有哪些 role

    role_sys_privs   --查看某个角色的 system privilege

    role_tab_privs   --查看某个角色的 object privilege

    image

    image

    image

    SELECT * FROM role_sys_privs WHERE role like ‘CONNECT’; --查看 connect 这个role有哪些系统特权

    image

    给用户的角色分为 2 种, 一种是登录后就自动有了这些角色,这些角色就是 default role. ( 直接 enable ), 还有一种,就是登录后,并不是自动的 enable, 而是需要输入某个命令才能使这些角色 enable.

    -1 将角色给用户

    -2 ALTER USER name DEFAULT ROLE role_name; -- 还有其他方法,如上图,all 等等.

    缺省角色是 r1 , 如果用于有2中角色,如果想使用 r2 角色,那么可以给role的口令保护,然后进入 r2

    SET ROLE r1, r2 identified password. ( default role 不需要口令,其他的role, 如果你想使用可以提供 口令

    image

    注意, enable 和 disable 是session临时, 也就是说, 下次再重新连接session时, 这个role 又恢复到可用状态了.

    image

    image

    The All option without the except clause works only when every role that is enabled does not have a password.

    第 1 行, 是使能一个角色,在这个里边的就是 enable, 否则就不是。

    image

    image

    image

    image

    In this example, admin_role is an application role and the role can be enabled only by modules define inside the PL/SQL package hr.employee.

    hr.employee 是个 PLSQL 包。(10g 查看联机文档,books –> security –> security guide –> 13章)

    image

    任务: role payroll 发工资,benefits

    用户: HR_CLERK

    Because a role includes the privileges necessary to perform a task, the role name is usually an application task or a job title. The example above uses both application tasks and job titles for role names.

    1. Create a role for each application task. The name of the application role corresponds to a task in the application, such as PAYROLL

    2. Assign the privileges necessary to perform the task to the application role.

    3. Create user role, The name of the user role corresponds to a job title, such as PAY_CLERK.

    4. Grant application roles to user’s roles.

    5. Grant user’s roles to users.

    image

    Passwords provide an additional level of security when enabling a role.

    参考上图, 需要执行以下步骤:

    image

    用户使用 系统( hwms 例如 ) 连接数据库,比较安全,但是限制太大

    用户使用 SQLPLUS 连接数据库,这样的话,可能修改很多东西,那么可以使用 default role, 一些查询的内容,使用 default role, 如果要修改,因为不是 default role, 就必须输入口令,那么,就无法修改,并且可以将role口令内嵌到系统中,那么,使用系统时,用户也可以修改内容。

    image

  • 相关阅读:
    hive函数总结
    python判断文件和目录是否存在
    python中的参数
    写hive db的两种方法
    python中argparse模块的使用
    python数据持久存储:pickle模块的使用
    python读文件
    mysql 将时间戳直接转换成日期时间
    shell日期的应用
    [转]SQL UNION 和 UNION ALL 操作符
  • 原文地址:https://www.cnblogs.com/moveofgod/p/2866006.html
Copyright © 2011-2022 走看看