accessControl

checkOutObject

Description

Reserves an object (and all of its children) for update by only the current client session. Prevents an object (and all of its parents) from being checked out exclusively by another session if checkOutType=Shared. This is part of a transactional model for managing access controls.

accessControl.checkOutObject <result=results> <status=rc> / checkoutParent=TRUE | FALSE, checkOutType="EXCLUSIVE" | "SHARED", ObjectSelector={objType="ACTION" | "ACTIONSET" | "CASLIB" | "COLUMN" | "TABLE", objType-specific-parameters} ;
Settings
ParameterDescription
checkoutParentIndicates whether to check out the parent object if the specified object does not exist. Default is FALSE.
checkOutTypeSpecifies the type of check-out. 'EXCLUSIVE' (default) allows only the current session to update the object. 'SHARED' prevents other sessions from getting an exclusive lock on the object or its parents.
ObjectSelectorSpecifies the object to check out. The required sub-parameters depend on the objType.
objType="ACTION"Used within ObjectSelector. Requires 'actionSet' and 'action' parameters.
objType="ACTIONSET"Used within ObjectSelector. Requires the 'actionSet' parameter.
objType="CASLIB"Used within ObjectSelector. Requires the 'caslib' parameter.
objType="COLUMN"Used within ObjectSelector. Requires 'caslib', 'table', and 'column' parameters.
objType="TABLE"Used within ObjectSelector. Requires 'caslib' and 'table' parameters.
Data Preparation View data prep sheet
Data Setup for Examples

This code sets up a caslib and a table required for the examples. It also creates an access control to demonstrate the checkout functionality.

Copied!
1PROC CAS;
2 caslib mycas path='/tmp/mycas' dataSource={srcType='path'} SESSION=true;
3 datastep.runCode / code='data mycas.cars; set sashelp.cars; run;';
4 ACCESSCONTROL.updSomeAcs caslib='mycas' TABLE='cars' grants={{grant='select', group='public'}};
5RUN;

Examples

This example demonstrates how to get an exclusive lock on the 'mycas.cars' table to prepare for updates. This prevents other sessions from modifying it.

SAS® / CAS Code Code awaiting community validation
Copied!
1 
2PROC CAS;
3ACCESSCONTROL.startTransaction;
4 
5RUN;
6ACCESSCONTROL.checkOutObject / objectSelector={objType='TABLE', caslib='mycas', TABLE='cars'}, checkOutType='EXCLUSIVE';
7 
8RUN;
9 
Result :
The action checks out the 'cars' table. A confirmation message is typically returned in the log, and the object is locked for the current session's transaction.

This example shows a complete transaction workflow. A shared checkout is used to prevent other exclusive locks while previewing the effect of a new access control rule. The transaction is then committed.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 /* Start a transaction to stage changes */
3 ACCESSCONTROL.startTransaction; RUN;
4 
5 /* Get a shared lock on the caslib to prevent other exclusive checkouts */
6 ACCESSCONTROL.checkOutObject /
7 objectSelector={objType='CASLIB', caslib='mycas'},
8 checkOutType='SHARED';
9 RUN;
10 
11 /* Add a new access control rule within the transaction */
12 ACCESSCONTROL.updSomeAcs caslib='mycas' TABLE='cars' grants={{grant='delete', group='sasusers'}};
13 RUN;
14 
15 /* Preview the effective access for a user */
16 ACCESSCONTROL.whatIsEffective /
17 objectSelector={objType='TABLE', caslib='mycas', TABLE='cars'},
18 principal='sasuser1';
19 RUN;
20 
21 /* Commit the transaction to make the changes permanent */
22 ACCESSCONTROL.commitTransaction;
23RUN;
Result :
The log will show the start of the transaction, the successful shared checkout, the staging of the new 'delete' grant, and the effective permissions for 'sasuser1' which now include 'delete'. Finally, a confirmation of the transaction commit is shown.

FAQ

What is the primary purpose of the checkOutObject action?
What are the available types for the 'checkOutType' parameter?
How do I specify the object to be checked out?
What is the function of the 'checkoutParent' parameter?
What parameters are required to check out a specific table column?

Associated Scenarios

Use Case
Securing Highly Sensitive HR Salary Columns

The HR department is updating access policies for the 'Salary' column in the employee database. They need to ensure that during the update process (transaction), no other admin ...

Use Case
Proactive Security with Parent Object Fallback

An automated security bot is scanning for a temporary table named 'Audit_Log'. If the table does not exist yet, the bot needs to lock the parent Library (Caslib) to safely creat...

Use Case
Shared Governance on Analytic Action Sets

During a regulatory compliance audit, the 'sampling' action set must be kept stable. The auditor wants to ensure that no administrator creates an EXCLUSIVE lock (which would imp...