There are two types
of federated SQL views for SAS Federation Server:
-
Invoker's rights view: An invoker's rights view is run
with the invoking user's credentials.
-
Definer's rights view: A definer's rights view is run
with the credentials of the schema owner.
The invoker’s
rights view is accessed using the current user’s authorization,
credentials, and login information while the definer's rights view
is accessed using the schema owner’s authorization, credentials
and login information. A definer’s rights view is always associated
with a schema owner.
A definer’s rights
view allows security management from a single layer of data, which
in turn provides for a more secured system. For example, there are
100 tables that provide data to a set of users. 10 views are created
and their data is acquired from the 100 tables. The users are selecting
from the 10 views to get their data. With invoker's rights views,
each invoker must have access to the 100 tables. This includes setting
privileges in SAS Federation Server, and ensuring
that each invoker has a login to the data sources containing the 100
tables.
With definer's rights
views, the data available through the view is accessed by a single
user only: the schema owner. Therefore, only this user, the schema
owner, needs server privileges and database logins to the data sources
containing the 100 tables. View invokers do not need direct access
to the underlying tables. The administrator can secure the definer's rights
view using Federation Server SQL authorizations
to control which users and groups have access to the view’s
result set. Unless explicitly specified as a definer’s rights
view, a view is created as an invoker’s rights view by default.
Here is an example of
creating an invoker’s rights view:
CREATE VIEW
view1 AS SELECT * FROM table1
Definer's rights views
are required for data caching. Only a schema owner can create a definer’s
rights view for a schema that he owns. A non-schema owner cannot create
a definer’s rights view for a schema for which he has the SELECT
privilege only. You can create a definer’s rights view using
the following example syntax:
CREATE VIEW
view1 SECURITY DEFINER AS SELECT * FROM table1
The following example
alters an existing view to be an invoker's rights view or a definer's
rights view. If a definer’s rights view has any associated
cache, it is dropped when the view is changed to an invoker’s
rights view.
ALTER VIEW
view1 SECURITY INVOKER
ALTER VIEW
view1 SECURITY DEFINER