CData Virtuality Server には、permissionsを設定するための特別な手順があります。Permissionは新しいセッション(СData Virtuality Studio、SquirreL などの新しいタブ)にのみ適用され、すでに作成されたセッション(すでに開いているタブ)には適用されないことに注意してください。
SYSADMIN.setPermissions
SYSADMIN.setPermissions(<
IN
string role_name>, <
IN
string resourceName>, <
IN
string permissions>, <
IN
string resourceType>, <
IN
string condition>, <
IN
boolean isConstaint>, <
IN
string mask>, <
IN
integer
maskOrder>, <
IN
string mapToRole>)
Mandatory Parameters
resourceName/permissions
とmapToRole
パラメータを同時に適用することはできません。mapToRole
はrole_name
パラメータにのみ使用できます。 resourceName/permissions
またはmapToRole
のいずれかを使用してください。
Parameter | Description |
---|---|
| Role name |
| Any resource path, e.g. "model", "model.table", or "model.table.column". resourceName could include a resource type prefix. Resource type prefix supported values are: |
| Consists of the first letters of all available types of permissions ( |
| Role name to be mapped to.
|
mapToRole
parameter is available since v4.2
Optional Parameters
オプションの4つの文字列を使うと、row-based security settings and column masking を使用できます。
Parameter | Description |
---|---|
| Type of the resource. Supported values: |
| Defines row-based security condition |
| Defines if values will be inserted/updated if the new value matches permission condition ( |
| Defines column mask value |
| Defines mask order if there are several masks for one column |
resourceType
parameter and resource type prefixes available since v4.9
Examples
1. ロールexample_role
のすべてのリソースにCRUDEAL Permissions を割り当てます:
CALL SYSADMIN.setPermissions(
"role_name"
=>
'example_role'
,
"resourceName"
=>
'*'
,
"permissions"
=>
'CRUDEAL'
)
2. SSO ロールexample_role@SSO
をData Virtuality admin-role
にマッピングします:
CALL SYSADMIN.setPermissions(
"role_name"
=>
'example_role@SSO'
,
"mapToRole"
=>
'admin-role'
)
すべてのPermissionはSYSADMIN.Permissions
テーブルに保存され、admin ユーザーと、このテーブルのPermissionを持つすべてのユーザーがアクセスできます。
SYSADMIN.hasPermission
このプロシージャは、あるユーザがあるリソースに対して特定の Permission を持っているかどうかを調べるために使われます。
SYSADMIN.hasPermission(<
IN
string username>, <
IN
string resource>, <
IN
string permissions>)
Parameters
Parameter | Description |
---|---|
| User name |
| Any resource path, e.g. " |
| Consists of the first letters of all available types of permissions ( |
以下は、test_user
がREAD
views
のPermission を持っているかどうかを調べる例です:
CALL SYSADMIN.hasPermissions(
'test_user'
,
'views'
,
'R'
)
SYSADMIN.hasPermission
procedure is available since v4.1
SYSADMIN.changeResourceOwnerAndExecutor
このプロシージャは、リソースの所有者や実行者といったPermission を変更するために使用されます。現在、プロシージャ、ジョブ、スケジュールをサポートしています。
SYSADMIN.changeResourceOwnerAndExecutor(<
IN
string
name
>, <
IN
string uuid>, <
IN
string resourceType>, <
IN
string owner>, <
IN
string executeAs>)
name または uuid (for jobs and schedules)
パラメータ、またはその両方を指定する必要があります。
Parameters
Parameter | Description |
---|---|
| Resource name |
| UUID of resource, valid only for jobs and schedules |
| Type of resource, field is mandatory, case-insensitive. Supported values are: |
| Name of the resource owner needs to be set. Owner could be set to a value that is not equal to the current user only by members of |
| Resource runner/executor ( |
以下は、ユーザー u1 をジョブtest1
のオーナーに設定する例です:
CALL
"SYSADMIN.changeResourceOwnerAndExecutor"
(
"name"
=>
'test1'
,
"resourceType"
=>
'job'
,
"owner"
=>
'u1'
);;
SYSADMIN.changeResourceOwnerAndExecutor
procedure available since v4.5
SYSADMIN.copyPermissions
このプロシージャは、権限をロールにコピーするために使用されます。
SYSADMIN.copyPermissions(<
IN
string sourceRoles>, <
IN
string permissionIds>, <
IN
string targetRole>, <
IN
boolean createRoleIfNotExist>)
sourceRoles
とpermissionIds
パラメータは、別々に指定することも、一緒に指定することもできます。
Parameters
Parameter | Description |
---|---|
| Source roles (comma-separated) whose permissions will be copied to the target role |
| IDs of permissions (comma-separated) that will be copied to the target role |
| The target role to which the permissions will be copied |
| If set to |
コピー元のロールまたはコピー元のパーミッションが同じオブジェクトに対して異なるパーミッションを持つ場合、コピーされたパーミッションは結合されます。コピーされた結合されたパーミッションと共にSQL警告がサーバーログに表示されます。
Examples
1. ロールtest_role1
およびtest_role2
からロールtarget-role2
に権限をコピーし、target-role2
が存在しない場合は作成します:
CALL
"SYSADMIN.copyPermissions"
(
"sourceRoles"
=>
'test_role1,test_role2'
,
"targetRole"
=>
'target-role2'
,
"createRoleIfNotExist"
=>
true
);;
2. ID が81
と85
の権限をロールtarget-role1
にコピーし、target-role1
が存在しない場合は作成します:
CALL
"SYSADMIN.copyPermissions"
(
"permissionIds"
=>
'81,85'
,
"targetRole"
=>
'target-role1'
,
"createRoleIfNotExist"
=>
true
);;
3. ID が81
と85
で、ロールtest-role1
から既存のロールtarget-role3
に権限をコピーします:
CALL
"SYSADMIN.copyPermissions"
(
"sourceRoles"
=>
'test_role1'
,
"permissionIds"
=>
'81,85'
,
"targetRole"
=>
'target-role3'
);;
SYSADMIN.copyPermissions
procedure is available since v4.10