lunes, 17 de marzo de 2014

El Problema con REVOKE

Probé este ejemplo en Oracle 11.2 para mostrar porque sea necesario prestar atención con el comando REVOKE. Si das el rol DBA a un usuario, Oracle le da a él también el privilegio UNLIMITED TABLESPACE

SQL> create user andrew identified by reid
  2  /
 
Usuario creado.
 
SQL> grant dba to andrew
  2  /
 
Concesión terminada correctamente.

SQL> select granted_role from dba_role_privs
  2  where grantee = 'ANDREW'
  3  /

GRANTED_ROLE
------------------------------
DBA

SQL> select privilege from dba_sys_privs
  2  where grantee = 'ANDREW'
  3  /

PRIVILEGE
----------------------------------------
UNLIMITED TABLESPACE


SQL>

Cuando se revoca el rol DBA de un usuario, Oracle revoca también el privilegio UNLIMITED TABLESPACE: 

SQL> revoke dba from andrew
  2  /

Revocación terminada correctamente.

SQL> select granted_role from dba_role_privs
  2  where grantee = 'ANDREW'
  3  /

ninguna fila seleccionada

SQL> select privilege from dba_sys_privs
  2  where grantee = 'ANDREW'
  3  /

ninguna fila seleccionada


SQL> 

¿Pero qué pasa si un usuario recibe el privilegio UNLIMITED TABLESPACE por sí mismo?

SQL> grant unlimited tablespace to andrew
  2  /

Concesión terminada correctamente.

SQL> select privilege from dba_sys_privs
  2  where grantee = 'ANDREW'
  3  /

PRIVILEGE
----------------------------------------
UNLIMITED TABLESPACE


SQL>

Y alguien le da el rol DBA:

SQL> grant dba to andrew
  2  /

Concesión terminada correctamente.

SQL> select granted_role from dba_role_privs
  2  where grantee = 'ANDREW'
  3  /

GRANTED_ROLE
------------------------------
DBA

SQL> select privilege from dba_sys_privs
  2  where grantee = 'ANDREW'
  3  /

PRIVILEGE
----------------------------------------
UNLIMITED TABLESPACE


SQL>

Luego se revoca el rol DBA:

SQL> revoke dba from andrew
  2  /

Revocación terminada correctamente.

SQL> select granted_role from dba_role_privs
  2  where grantee = 'ANDREW'
  3  /

ninguna fila seleccionada


SQL>

Este usuario pierde también el privilegio UNLIMITED TABLESPACE y tal vez no querías hacer esto:

SQL> select privilege from dba_sys_privs
  2  where grantee = 'ANDREW'
  3  /

ninguna fila seleccionada

SQL>



No hay comentarios:

Publicar un comentario