3.2.3.5.4 データストアへのアクセスの制御
ore.grant関数およびore.revoke関数を使用すると、OML4Rのデータストアへのアクセス権を付与したり、取り消すことができます。
ore.grantおよびore.revoke関数では、データストアへのアクセスを制御できます。自分が所有するデータストアへの読取りアクセス権を、指定したユーザーに付与したり、アクセス権限を取り消すことができます。関数ore.save、ore.load、ore.datastoreおよびore.datastoreSummaryには、データストアのアクセス権に関連する引数があります。
ノート:
ore.createを使用して永続データベース表およびそのプロキシore.frameオブジェクトを作成し、付与可能なデータストアにプロキシore.frameオブジェクトを保存した後、ore.grantを使用してデータストアへの読取りアクセス権を付与した場合、アクセス権はore.frameオブジェクトにのみ適用されます。読取りアクセス権は、永続データベース表には拡張されません。表自体への読取り権限を付与するには、適切なSQLコマンドを実行する必要があります。
例3-19 データストアへのアクセス権の付与および取消し
この例では、ローカルのRセッションからOracleデータベースにairqualityデータセットをプッシュしますが、これは、ore.frameオブジェクトAIRQUALITYとして、また、同じ名前の一時データベース表として存在します。この例では次に、AIRQUALITYオブジェクトをデータストアds3に保存し、そのデータストアへのアクセス権を他のユーザーに付与できるように指定します。type = grantableを指定して関数ore.datastoreをコールし、読取りアクセス権が付与されているすべてのデータストアを表示します。ds3データストアの読取り権限をSCOTTに付与します。その後、type = grantを指定してore.datastoreをコールし、読取りアクセス権が付与されているデータストアを表示します。SCOTTの読取り権限を取り消し、アクセス権が付与されているデータストアを再度表示します。
AIRQUALITY <- ore.push(airquality)
ore.save(AIRQUALITY, name = "ds3",
description = "My datastore 3", grantable = TRUE)
ore.datastore(type = "grantable")
ore.datastore(type = "grant")
ore.grant("ds3", type = "datastore", user = "SCOTT")
ore.datastore(type = "grant")
ore.revoke("ds3", type = "datastore", user = "SCOTT")
ore.datastore(type = "grant")この例のリスト
R> AIRQUALITY <- ore.push(airquality)
R> ore.save(AIRQUALITY, name = "ds3",
+ description = "My datastore 3", grantable = TRUE)
R> ore.datastore(type = "grantable")
datastore.name object.count size creation.date description
1 ds3 1 1451 2015-11-30 18:48:25 My datastore 3
R> ore.datastore(type = "grant")
[1] datastore.name grantee
<0 rows> (or 0-length row.names)
R> ore.grant("ds3", type = "datastore", user = "SCOTT")
R> ore.datastore(type = "grant")
datastore.name grantee
1 ds3 SCOTT
R> ore.revoke("ds3", type = "datastore", user = "SCOTT")
R> ore.datastore(type = "grant")
[1] datastore.name grantee
<0 rows> (or 0-length row.names)親トピック: データベースでのRオブジェクトの保存および管理