Application roles

An application role is a database role that allows access to specific data to only those users that connect using a particular application.

Database Explorer allows you to perform operations on application roles using the shortcut menu. Right-click an application role in Database Explorer to access commands for specific tasks, such as managing roles or search for them in Security Manager.

Create an application role

You can create an application role in one of these ways:

  • In SQL Editor:
    • Code completion to write a script.
    • SQL snippets to insert predefined or custom code.
  • In a visual Security Manager.

Edit an application role

1. In Database Explorer, right-click the application role and select Edit Application Role.

2. In Security Manager, update the role details.

3. On the SQL toolbar, click Save to save the changes.

Alternatively, in the top menu, select File > Save, or press Ctrl+S.

Duplicate an application role

1. In Database Explorer, right-click a required application role and select Duplicate Object.

2. In the Duplicate Object dialog, configure the object settings:

  • In Destination database, select the target database.
  • In New object name, specify the object name.

3. Click OK.

Delete an application role

1. In Database Explorer, right-click the application role you want to delete and select Delete, or press Delete.

2. Click Yes to confirm the deletion.

Note

You cannot undo the drop operation, as this action permanently deletes all its data and structure. It is recommended that you back up the database before deleting it.

Generate a script for an application role

1. In Database Explorer, right-click a required application role and select Generate Script As, then select the statement type.

2. Select the output option:

  • To New SQL Window – Opens the script in a new SQL document.
  • To File – Generates the script to a .sql file.
  • To Clipboard – Copies the script to the clipboard.

For more information, see Generate the DDL and DML statements for database objects.

Find an object in Security Manager

To find an application role in Security Manager, in Database Explorer, right-click the application role or Application Roles node and select Find in Security Manager.

Security Manager opens and highlights the object you look for.

View application role properties

To view role properties, in Database Explorer, right-click the application role or Application Roles node and select Show Details.

Object Viewer opens, displaying detailed information about the application role.

Refresh application roles

To update the application role to reflect the latest changes, in Database Explorer, right-click the application role or Application Roles node and select Refresh, or press F5.

Open the Properties window

To open the Properties window, in Database Explorer, right-click the application role and select Properties, or press F4.

Filter application roles

1. In Database Explorer, right-click the Application Roles node and select Filter.

2. In the Filter Settings dialog, configure the filter parameters.

3. Click OK to apply the filter.

Note

When you open the Application Roles node, the number of objects it contains appears in parentheses next to the node name. This number changes based on your filter settings.

Shortcut menu options for a specific application role

The following table describes the shortcut menu options, which appear when you right-click a specific application role in Database Explorer.

Name Description
Edit Application Role Opens Security Manager to update the application role.
Source Control > Source Control Manager Opens Source Control Manager, where you can track and manage changes to database schema and static data.
When Source Control Manager is already open, this option refreshes it.
Source Control > Commit Opens Source Control Manager with all local changes (if any) selected and ready to commit.
When Source Control Manager is already open, this option refreshes it and selects all local database changes.
Source Control > Get Latest Opens Source Control Manager with all remote changes (if any) selected, ready to pull using Get Latest.
When Source Control Manager is already open, this option refreshes it and selects all remote database changes.
Duplicate Object Opens the Duplicate Object dialog to duplicate the object.
Find in Security Manager Opens Security Manager to find the selected application role.
Generate Script As Generates a script of the selected object using the CREATE, DROP, and DROP and CREATE statements. The script can be saved to a new SQL document or to a file, or copied to the clipboard.
Show Details Opens Object Viewer to view object details.
Delete Drops the selected object from the database.
Shortcut: Delete
Refresh Updates the object to reflect the latest changes.
Shortcut: F5
Properties Opens the Properties pane to view the object information.
Shortcut: F4

Shortcut menu options for the Application Roles node

The following table describes the shortcut menu options, which appear when you right-click the Application Roles node in Database Explorer.

Name Description
Source Control > Source Control Manager Opens Source Control Manager, where you can track and manage changes to database schema and static data.
When Source Control Manager is already open, this option refreshes it.
Source Control > Commit Opens Source Control Manager with all local changes (if any) selected and ready to commit.
When Source Control Manager is already open, this option refreshes it and selects all local database changes.
Source Control > Get Latest Opens Source Control Manager with all remote changes (if any) selected, ready to pull using Get Latest.
When Source Control Manager is already open, this option refreshes it and selects all remote database changes.
Filter Opens the Filter Settings dialog to control which application roles should appear in Database Explorer.
Find in Security Manager Opens Security Manager to find application roles.
Show Details Opens Object Viewer to view object details.
Refresh Updates the object to reflect the latest changes.
Shortcut: F5

Note

The Source Control shortcut menu is available only after you link the corresponding database to a source-control system.

Bulk operations

In Database Explorer, hold down Ctrl and select multiple application roles. Then right-click the selection and select the required option.

The following table describes the shortcut menu options available for multiple application roles.

Name Description
Edit Application Role Opens Security Manager to edit the selected application roles.
Source Control > Source Control Manager Opens Source Control Manager, where you can track and manage changes to database schema and static data.
When Source Control Manager is already open, this option refreshes it.
Source Control > Commit Opens Source Control Manager with all local changes (if any) selected and ready to commit.
When Source Control Manager is already open, this option refreshes it and selects all local database changes.
Source Control > Get Latest Opens Source Control Manager with all remote changes (if any) selected, ready to pull using Get Latest.
When Source Control Manager is already open, this option refreshes it and selects all remote database changes.
Source Control > Link/Unlink Static Data Opes the Source Control Link Static Data dialog that displays the tables whose data you want to link.
Generate Script As Generates scripts of the selected objects using the CREATE, DROP, and DROP and CREATE statements. The scripts can be generated to a new SQL document or to a file, or copied to the clipboard.
Delete Drops the selected application roles from the database.
Shortcut: Delete

Bulk operations for multiple application roles