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.
|
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 |
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.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.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');;