Beginning SQL

Beginning SQL Beginning SQL

marjan.fesb.hr
from marjan.fesb.hr More from this publisher
20.07.2013 Views

The CASCADE option tells the DBMS that a REVOKE of the GRANT OPTION should cause a ripple down the chain and also revoke any privileges issued because of the GRANT OPTION. Suppose Jim issues a GRANT to Sue WITH GRANT OPTION: GRANT SELECT ON tblPersonnel TO usrSue WITH GRANT OPTION Sue now issues a GRANT to Frank: GRANT SELECT ON tblPersonnel TO usrFrank Jim now issues a REVOKE to Sue: REVOKE SELECT ON tblPersonnel FROM usrSue CASCADE In this case, both Sue and Frank lose their SELECT privilege on tblPersonnel because Jim placed the CASCADE option on the REVOKE statement. Assume that Jim issued the same GRANT to Sue, and Sue issued the same GRANT to Frank. Jim later issues the following REVOKE: REVOKE SELECT ON tblPersonnel FROM usrSue RESTRICT In this case, the REVOKE fails and issues an error warning Jim that there are privileges cascading down from the GRANT that he issued, and that he may be revoking privileges that he doesn’t intend to revoke. If Jim does decide to revoke Sue’s privileges, he can simply issue the REVOKE again with the CASCADE option. The RESTRICT option is just a way to let a user know that the REVOKE will cause a cascade REVOKE. In addition, the SQL2 syntax now includes the ability to specify the privilege in the REVOKE GRANT statement instead of just revoking all GRANT privileges. Consider the following statement: REVOKE GRANT OPTION ON INSERT, DELETE ON tblPersonnel FROM usrSue CASCADE SQL Security This statement revokes the ability to GRANT OPTION on these privileges but does not take away the privileges themselves. 347

The CASCADE option tells the DBMS that a REVOKE of the GRANT OPTION should cause a ripple down the<br />

chain and also revoke any privileges issued because of the GRANT OPTION.<br />

Suppose Jim issues a GRANT to Sue WITH GRANT OPTION:<br />

GRANT SELECT<br />

ON tblPersonnel<br />

TO usrSue<br />

WITH GRANT OPTION<br />

Sue now issues a GRANT to Frank:<br />

GRANT SELECT<br />

ON tblPersonnel<br />

TO usrFrank<br />

Jim now issues a REVOKE to Sue:<br />

REVOKE SELECT<br />

ON tblPersonnel<br />

FROM usrSue CASCADE<br />

In this case, both Sue and Frank lose their SELECT privilege on tblPersonnel because Jim placed the<br />

CASCADE option on the REVOKE statement.<br />

Assume that Jim issued the same GRANT to Sue, and Sue issued the same GRANT to Frank. Jim later issues<br />

the following REVOKE:<br />

REVOKE SELECT<br />

ON tblPersonnel<br />

FROM usrSue RESTRICT<br />

In this case, the REVOKE fails and issues an error warning Jim that there are privileges cascading down<br />

from the GRANT that he issued, and that he may be revoking privileges that he doesn’t intend to revoke.<br />

If Jim does decide to revoke Sue’s privileges, he can simply issue the REVOKE again with the CASCADE<br />

option. The RESTRICT option is just a way to let a user know that the REVOKE will cause a cascade<br />

REVOKE.<br />

In addition, the <strong>SQL</strong>2 syntax now includes the ability to specify the privilege in the REVOKE GRANT statement<br />

instead of just revoking all GRANT privileges. Consider the following statement:<br />

REVOKE GRANT OPTION ON INSERT, DELETE<br />

ON tblPersonnel<br />

FROM usrSue CASCADE<br />

<strong>SQL</strong> Security<br />

This statement revokes the ability to GRANT OPTION on these privileges but does not take away the privileges<br />

themselves.<br />

347

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!