Home > Articles > Security > Software Security

This chapter is from the book

Granting Authorities and Privileges

There are three different ways that users (and groups) can obtain database-level authorities and database/object privileges. They are:

  • Implicitly. When a user creates a database, they implicitly receive DBADM authority for that database, along with several database privileges. Likewise, when a user creates a database object, they implicitly receive all privileges available for that object along with the ability to grant any combination of those privileges (with the exception of the CONTROL privilege), to other users and groups. Privileges can also be implicitly given whenever a higher-level privilege is explicitly granted to a user (for example, if a user is explicitly given CONTROL privilege for a tablespace, they will implicitly receive the USE privilege for that tablespace as well). Keep in mind that such implicitly assigned privileges are not automatically revoked when the higher-level privilege that caused them to be granted is revoked.

  • Indirectly. Indirectly assigned privileges are usually associated with packages; when a user executes a package that requires privileges to execute that the user does not have (for example, a package that deletes a row of data from a table requires the DELETE privilege on that table), the user is indirectly given those privileges for the express purpose of executing the package. Indirectly granted privileges are temporary and do not exist outside the scope in which they are granted.

  • Explicitly. Database-level authorities, database privileges, and object privileges can be explicitly given to or taken from an individual user or a group of users by any user that has the authority to do so. To explicitly grant privileges on most database objects, a user must have SYSADM authority, DBADM authority, or CONTROL privilege on that object. Alternately, a user can explicitly grant any privilege they were assigned with the WITH GRANT OPTION specified. To grant CONTROL privilege for any object, a user must have SYSADM or DBADM authority; to grant DBADM authority, a user must have SYSADM authority.

Granting and Revoking Authorities and Privileges from the Control Center

One way to explicitly grant and revoke database-level authorities, as well as several available privileges, is by using the various authorities and privileges management dialogs that are provided with the Control Center. These dialogs are activated by highlighting the appropriate database or object name shown in the Control Center panes and selecting either Authorities or Privileges from the corresponding database or object menu. Figure 3-15 shows the menu items that must be selected in the Control Center in order to activate the Table Privileges dialog for a particular table. Figure 3-16 shows how the Table Privileges dialog might look immediately after a table is first created. (A single check mark under a privilege means that the individual or group shown has been granted that privilege; a double check mark means the individual or group has also been granted the ability to grant that privilege to other users and groups.)

03fig15.jpgFigure 3-15. Invoking the Table Privileges dialog from the Control Center.

03fig16.gifFigure 3-16. The Table Privileges dialog.

To assign privileges to an individual user from the Table Privileges dialog (or a similar authorities/privileges dialog), you simply identify a particular user by highlighting their entry in the recognized users list—if the desired user is not in the list, they can be added by selecting the “Add User” push button—and assign the appropriate privileges (or authorities) using the “Privileges” (or “Authorities”) drop-down list or the “Grant All” or “Revoke All” push buttons. To assign privileges to a group of users, you select the “Group” tab to display a list of recognized groups and repeat the process (using the “Add Group” push button instead of the “Add User” push button to add a desired group to the list if they are not already there).

Granting Authorities and Privileges with the GRANT SQL Statement

Not all privileges can be explicitly given to users/groups with the privileges management dialogs available. However, in situations where no privileges dialog exists (and in situations where you elect not to use the Control Center), database-level authorities and database/object privileges can be explicitly given to users and/or groups by executing the appropriate form of the GRANT SQL statement. The syntax for the GRANT SQL statement varies according to the authority or privilege being granted—the following sections show the syntax used to grant each database-level authority and database/object privilege available.

Database-level authorities and privileges

GRANT [DBADM | Privilege, ...] ON DATABASE TO [Recipient, ...]
   

where:

Privilege

Identifies one or more database privileges that are to be given to one or more users and/or groups.

Recipient

Identifies the name of the user(s) and/or group(s) that are to receive DBADM authority or the database privileges specified

Schema privileges

GRANT [Privilege, ...] ON SCHEMA [SchemaName] TO        [Recipient, ...] <WITH GRANT OPTION>
   

where:

Privilege

Identifies one or more schema privileges that are to be given to one or more users and/or groups.

SchemaName

Identifies by name the specific schema that all schema privileges specified are to be associated with.

Recipient

Identifies the name of the user(s) and/or group(s) that are to receive the schema privileges specified.

Tablespace privilege

GRANT USE OF TABLESPACE [TablespaceName]
   TO [Recipient, ...]
   <WITH GRANT OPTION>
   

where:

TablespaceName

Identifies by name the specific tablespace that the USE privilege is to be associated with.

Recipient

Identifies the name of the user(s) and/or group(s) that are to receive the USE privilege.

Table privileges

GRANT [ALL <PRIVILEGES> |
   Privilege <( ColumnName, ... )>  , ...]
   ON TABLE [TableName] TO [Recipient, ...]
   <WITH GRANT OPTION>
   

where:

Privilege

Identifies one or more table privileges that are to be given to one or more users and/or groups.

ColumnName

Identifies by name one or more specific columns that UPDATE or REFERENCES privileges are to be associated with. This option is not used if Privilege is not equal to UPDATE or REFERENCES.

TableName

Identifies by name the specific table that all table privileges specified are to be associated with.

Recipient

Identifies the name of the user(s) and/or group(s) that are to receive the table privileges specified.

Index privilege

GRANT CONTROL ON INDEX [IndexName] TO [Recipient, ...]
   

where:

IndexName

Identifies by name the specific index that the CONTROL privilege is to be associated with.

Recipient

Identifies the name of the user(s) and/or group(s) that are to receive the CONTROL privilege.

View privileges

GRANT [ALL <PRIVILEGES> |
   Privilege <( ColumnName, ... )>  , ...]
   ON [ViewName]
   TO [Recipient, ...]
   <WITH GRANT OPTION>
   

where:

Privilege

Identifies one or more view privileges that are to be given to one or more users and/or groups.

ColumnName

Identifies by name one or more specific columns that UPDATE privilege is to be associated with. This option is not used if Privilege is not equal to UPDATE.

ViewName

Identifies by name the specific view that all view privileges specified are to be associated with.

Recipient

Identifies the name of the user(s) and/or group(s) that are to receive the view privileges specified.

Package privileges

GRANT [Privilege, ...] ON PACKAGE <SchemaName.> [PackageID] TO [Recipient, ...] <WITH
   graphics/ccc.gif GRANT OPTION>
   

where:

Privilege

Identifies one or more package privileges that are to be given to one or more users and/or groups.

SchemaName

Identifies by name the schema in which the specified package is found.

PackageName

Identifies by name the specific package that all package privileges specified are to be associated with.

Recipient

Identifies the name of the user(s) and/or group(s) that are to receive the package privileges specified.

Routine privileges

GRANT EXECUTE ON [RoutineName |
   FUNCTION <SchemaName.> * |
   METHOD * FOR [TypeName] |
   METHOD * FOR <SchemaName.> * |
   PROCEDURE <SchemaName.> *]
   TO [Recipient, ...]
   <WITH GRANT OPTION>
   

where:

RoutineName

Identifies by name the routine that the EXECUTE privilege is to be associated with.

TypeName

Identifies by name the type in which the specified method is found.

SchemaName

Identifies by name the schema in which all functions, methods, or procedures—including those that may be created in the future—are to have the EXECUTE privilege granted on.

Recipient

Identifies the name of the user(s) and/or group(s) that are to receive the EXECUTE privilege.

Sequence privilege

GRANT USAGE ON SEQUENCE [SequenceName] TO PUBLIC
   

where:

SequenceName

Identifies by name the specific sequence that the USAGE privilege is to be associated with.

Server privilege

GRANT PASSTHRU ON SERVER [ServerName] TO [Recipient, ...]
   

where:

ServerName

Identifies by name the specific server that the PASSTHRU privilege is to be associated with.

Recipient

Identifies the name of the user(s) and/or group(s) that are to receive the PASSTHRU privilege.

Nickname privileges

GRANT [ALL <PRIVILEGES> | Privilege <( ColumnName, ... )>  , ...] ON [Nickname] TO
   graphics/ccc.gif [Recipient, ...] <WITH GRANT OPTION>
   

where:

Privilege

Identifies one or more nickname privileges that are to be given to one or more users and/or groups.

ColumnName

Identifies by name one or more specific columns that the REFERENCES privilege is to be associated with. This option is not used if Privilege is not equal to REFERENCES.

Nickname

Identifies by name the specific nickname that all privileges specified are to be associated with.

Recipient

Identifies the name of the user(s) and/or group(s) that are to receive the nickname privileges specified.

If the WITH GRANT OPTION clause is specified with the GRANT statement, the user and/or group receiving the privileges specified is given the ability to grant the privilege received (except for the CONTROL privilege) to other users. In all cases, the value specified for the Recipient parameter can be any combination of the following:

USER [UserName]

Identifies a specific user that the privileges specified are to be given to.

GROUP [GroupName]

Identifies a specific group that the privileges specified are to be given to.

PUBLIC

Indicates that the specified privilege(s) are to be given to the special group PUBLIC. (All users are a member of the group PUBLIC).

GRANT SQL statement examples

Now that we've seen the basic syntax for the various forms of the GRANT SQL statement, let's take a look at some examples.

Example 1. A server has both a user and a group named TESTER. Give the group TESTER the ability to bind applications to the database SAMPLE:

CONNECT TO SAMPLE
GRANT BINDADD ON DATABASE TO GROUP tester

Example 2. Give all table privileges available (except CONTROL privilege) for the table PAYROLL.EMPLOYEE to the group PUBLIC:

GRANT ALL PRIVILEGES ON TABLE payroll.employee TO PUBLIC

Example 3. Give user USER1 and user USER2 the privileges needed to perform just DML operations on the table DEPARTMENT using the view DEPTVIEW:

GRANT SELECT, INSERT, UPDATE, DELETE ON deptview TO USER user1, USER user2

Example 4. Give user JOHN_DOE the privilege needed to query the table INVENTORY, along with the ability to grant this privilege to other users whenever appropriate:

GRANT SELECT ON TABLE inventory TO john_doe WITH GRANT OPTION

Example 5. Give user USER1 the ability to run an embedded SQL application that requires package GET_INVENTORY:

GRANT EXECUTE ON PACKAGE get_inventory TO USER user1

Example 6. Give user USER1 the ability to use a user-defined function named PAYROLL.CALC_SALARY that has an input parameter of type CHAR(5) in a query:

GRANT EXECUTE ON FUNCTION payroll.calc_salary(CHAR(5)) TO USER user1

Example 7. Give user USER1 the ability to define a referential constraint between the tables EMPLOYEE and DEPARTMENT using column EMPID in table EMPLOYEE as the parent key:

GRANT REFERENCES(empid) ON TABLE employee TO USER user1

Example 8. Give the group PUBLIC the ability to modify information stored in the ADDRESS and HOME_PHONE columns of the table EMP_INFO:

GRANT UPDATE(address, home_phone) ON TABLE emp_info TO PUBLIC

Revoking Authorities and Privileges with the REVOKE SQL Statement

Just as there is an SQL statement that can be used to grant database-level authorities and database/object privileges, there is an SQL statement that can be used to revoke database-level authorities and database/object privileges. This statement is the REVOKE SQL statement, and like the GRANT statement, the syntax for the REVOKE statement varies according to the authority or privilege being revoked—the following sections show the syntax used to revoke each database-level authority and database/object privilege available.

Database-level authorities and privileges

REVOKE [DBADM | Privilege, ...] ON DATABASE FROM [Forfeiter, ...] <BY ALL>
   

where:

Privilege

Identifies one or more database privileges that are to be taken from one or more users and/or groups.

Forfeiter

Identifies the name of the user(s) and/or group(s) that are to lose DBADM authority or the database privileges specified.

Schema privileges

REVOKE [Privilege, ...] ON SCHEMA [SchemaName] FROM [Forfeiter, ...] <BY ALL>
   

where:

Privilege

Identifies one or more schema privileges that are to be taken from one or more users and/or groups.

SchemaName

Identifies by name the specific schema that all schema privileges specified are to be associated with.

Forfeiter

Identifies the name of the user(s) and/or group(s) that are to lose the schema privileges specified.

Tablespace privilege

REVOKE USE OF TABLESPACE [TablespaceName] FROM [Forfeiter, ...] <BY ALL>
   

where:

TablespaceName

Identifies by name the specific tablespace that the USE privilege is to be associated with.

Forfeiter

Identifies the name of the user(s) and/or group(s) that are to lose the USE privilege.

Table privileges

REVOKE [ALL <PRIVILEGES> | Privilege, ...] ON TABLE [TableName] FROM [Forfeiter, ...] <BY ALL>
   

where:

Privilege

Identifies one or more table privileges that are to be taken from one or more users and/or groups.

TableName

Identifies by name the specific table that all table privileges specified are to be associated with.

Forfeiter

Identifies the name of the user(s) and/or group(s) that are to lose the table privileges specified.

Index privilege

REVOKE CONTROL ON INDEX [IndexName] FROM [Forfeiter, ...] <BY ALL>
   

where:

IndexName

Identifies by name the specific index that the CONTROL privilege is to be associated with.

Forfeiter

Identifies the name of the user(s) and/or group(s) that are to lose the CONTROL privilege.

View privileges

REVOKE [ALL <PRIVILEGES> | Privilege, ...] ON [ViewName] FROM [Forfeiter, ...] <BY ALL>
   

where:

Privilege

Identifies one or more view privileges that are to be taken from one or more users and/or groups.

ViewName

Identifies by name the specific view that all view privileges specified are to be associated with.

Forfeiter

Identifies the name of the user(s) and/or group(s) that are to lose the view privileges specified.

Package privileges

REVOKE [Privilege, ...] ON PACKAGE <SchemaName.> [PackageID] FROM [Forfeiter, ...] <BY ALL>
   

where:

Privilege

Identifies one or more package privileges that are to be taken from one or more users and/or groups.

SchemaName

Identifies by name the schema in which the specified package is found.

PackageName

Identifies by name the specific package that all package privileges specified are to be associated with.

Forfeiter

Identifies the name of the user(s) and/or group(s) that are to lose the package privileges specified.

Routine privileges

REVOKE EXECUTE ON [RoutineName |
   FUNCTION <SchemaName.> * |
   METHOD * FOR [TypeName] |
   METHOD * FOR <SchemaName.> * |
   PROCEDURE <SchemaName.> *]
   FROM [Forfeiter, ...] <BY ALL> RESTRICT
   

where:

RoutineName

Identifies by name the routine that the EXECUTE privilege is to be associated with.

TypeName

Identifies by name the type in which the specified method is found.

SchemaName

Identifies by name the schema in which all functions, methods, or procedures—including those that may be created in the future—are to have the EXECUTE privilege revoked on.

Forfeiter

Identifies the name of the user(s) and/or group(s) that are to lose the package privileges specified.

Sequence privilege

REVOKE USAGE ON SEQUENCE [SequenceName] FROM PUBLIC
   

where:

SequenceName

Identifies by name the specific sequence that the USAGE privilege is to be associated with.

Server privilege

REVOKE PASSTHRU ON SERVER [ServerName] FROM [Forfeiter, ...] <BY ALL>
   

where:

ServerName

Identifies by name the specific server that the PASSTHRU privilege is to be associated with.

Forfeiter

Identifies the name of the user(s) and/or group(s) that are to lose the PASSTHRU privilege.

Nickname privileges

REVOKE [ALL <PRIVILEGES> | Privilege, ...] ON [Nickname] FROM [Forfeiter, ...] <BY ALL>
   

where:

Privilege

Identifies one or more nickname privileges that are to be given to one or more users and/or groups.

Nickname

Identifies by name the specific nickname that all privileges specified are to be associated with.

Forfeiter

Identifies the name of the user(s) and/or group(s) that are to lose the nickname privileges specified.

The BY ALL syntax is optional and is provided as a courtesy for administrators who are familiar with the syntax of the DB2 for OS/390 REVOKE SQL statement. Whether it is included or not, the results will always be the same—the privilege(s) specified will be revoked from all users and/or groups specified, regardless of who granted it originally.

In all cases, the value specified for the Forfeiter parameter can be any combination of the following:

USER [UserName]

Identifies a specific user that the privileges specified are to be taken from.

GROUP [GroupName]

Identifies a specific group that the privileges specified are to be taken from.

PUBLIC

Indicates that the specified privilege(s) are to be taken from the special group PUBLIC. (All users are a member of the group PUBLIC.)

REVOKE SQL statement examples

Now that we've seen the basic syntax for the various forms of the REVOKE SQL statement, let's take a look at some examples.

Example 1. A server has both a user and a group named Q045. Remove the ability to connect to the database named SAMPLE from the group Q045:

CONNECT TO SAMPLE
REVOKE CONNECT ON DATABASE FROM GROUP q045

Example 2. Revoke all table privileges available (except CONTROL privilege) for the table DEPARTMENT from the user USER1 and the group PUBLIC:

REVOKE ALL PRIVILEGES ON TABLE department FROM user1, PUBLIC

Example 3. Take away user USER1's ability to use a user-defined function named CALC_BONUS:

REVOKE EXECUTE ON FUNCTION calc_bonus FROM USER user1

Example 4. Take away user USER1's ability to modify information stored in the ADDRESS and HOME_PHONE columns of the table EMP_INFO, regardless of who granted it:

REVOKE UPDATE(address, home_phone) ON TABLE emp_info FROM user1 BY ALL

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020