It is crucial to remember that accessControl.remAllAcsData only removes Table-Level permissions. If you have applied Column-Level security (e.g., hiding a "Salary" column from specific users), those rules are stored separately and will persist even after you run this command. You must use accessControl.remAllAcsColumn if you want to perform a true "clean slate" reset on the data structure.
Attention : This code requires administrator privileges.
The accessControl.remAllAcsData action is used to revoke all direct access controls (ACLs) specifically defined on a CAS table. Once this action is executed, the table's access permissions are again determined by the access rules of the CAS library (caslib) to which it belongs. This action is essential for simplifying permission management or for correcting specific access configurations that might hinder inherited access. It only affects table-level access controls and not column-level access controls.
Data Analysis
Type : CREATION_INTERNE
The examples create temporary CAS tables for demonstration purposes, using either datalines or SASHELP data.
1 Code Block
CAS Action / DATA STEP Data
Explanation : This example creates a temporary table 'ma_table_test' in a temporary caslib '_NAME_TEMP_'. A direct access control is then applied for a dummy user ('sasguest'). The `accessControl.remAllAcsData` action is then used to remove this direct access control, reverting the table to inherit permissions from the caslib. Verification steps (`showTableAcl`) allow confirming the permission status before and after the operation. The example includes the creation and cleanup of temporary resources.
Copied!
CAS casauto;
/* Création d'une caslib temporaire et d'une table simple */
caslib _NAME_TEMP_ cas datasource=(srctype='path') path='/tmp/';
data _NAME_TEMP_.ma_table_test;
x=1;
output;
run;
/* Appliquer un contrôle d'accès direct pour la démonstration */
accessControl.addTableAcl / caslib='_NAME_TEMP_', table='ma_table_test', userId='sasguest', perm='read';
/* Vérifier les contrôles d'accès avant la réinitialisation (optionnel) */
proc cas;
accessControl.showTableAcl / caslib='_NAME_TEMP_', table='ma_table_test';
run;
/* Réinitialiser tous les contrôles d'accès directs pour 'ma_table_test' */
accessControl.remAllAcsData /
caslib='_NAME_TEMP_',
table='ma_table_test';
/* Vérifier les contrôles d'accès après la réinitialisation */
proc cas;
accessControl.showTableAcl / caslib='_NAME_TEMP_', table='ma_table_test';
run;
/* Nettoyage */
proc cas;
table.dropTable / caslib='_NAME_TEMP_', name='ma_table_test';
caslib.dropCaslib / caslib='_NAME_TEMP_';
run;
1
CAS casauto;
2
3
/* Création d'une caslib temporaire et d'une table simple */
4
caslib _NAME_TEMP_ cas datasource=(srctype='path') path='/tmp/';
5
DATA _NAME_TEMP_.ma_table_test;
6
x=1;
7
OUTPUT;
8
RUN;
9
10
/* Appliquer un contrôle d'accès direct pour la démonstration */
Explanation : This example illustrates reverting access controls for a table after several direct permissions have been applied. It creates an 'autre_table' based on SASHELP.CLASS, adds specific permissions for 'sasguest' and 'sasuser', then uses `remAllAcsData` to revoke everything. Verification is performed before and after the reset to visualize the change and ensure the table has returned to its inherited access state.
Copied!
CAS casauto;
/* Création d'une caslib temporaire et d'une table */
caslib _NAME_TEMP_2 cas datasource=(srctype='path') path='/tmp/';
data _NAME_TEMP_2.autre_table;
set sashelp.class;
run;
/* Appliquer des ACLs directes variées */
accessControl.addTableAcl / caslib='_NAME_TEMP_2', table='autre_table', userId='sasguest', perm='read';
accessControl.addTableAcl / caslib='_NAME_TEMP_2', table='autre_table', userId='sasuser', perm='update';
/* Afficher les ACLs avant de les retirer */
proc cas;
accessControl.showTableAcl / caslib='_NAME_TEMP_2', table='autre_table';
run;
/* Réinitialiser les contrôles d'accès directs */
accessControl.remAllAcsData / caslib='_NAME_TEMP_2', table='autre_table';
/* Afficher les ACLs après réinitialisation pour confirmer l'héritage */
proc cas;
accessControl.showTableAcl / caslib='_NAME_TEMP_2', table='autre_table';
run;
/* Nettoyage */
proc cas;
table.dropTable / caslib='_NAME_TEMP_2', name='autre_table';
caslib.dropCaslib / caslib='_NAME_TEMP_2';
run;
1
CAS casauto;
2
3
/* Création d'une caslib temporaire et d'une table */
4
caslib _NAME_TEMP_2 cas datasource=(srctype='path') path='/tmp/';
Explanation : This example deepens the understanding of permission inheritance. A table is created and its initial permissions (inherited from the caslib) are displayed. Then, a direct permission is added to the table. `remAllAcsData` is used to remove this direct permission, demonstrating how inherited access becomes predominant again. The goal is to clearly show the impact of the reset on the permission cascade.
Copied!
CAS casauto;
/* Création d'une caslib et d'une table */
caslib _NAME_TEMP_3 cas datasource=(srctype='path') path='/tmp/';
data _NAME_TEMP_3.table_heritee;
x=1; y=2;
run;
/* Afficher les permissions initiales de la caslib et de la table */
proc cas;
accessControl.showCaslibAcl / caslib='_NAME_TEMP_3';
accessControl.showTableAcl / caslib='_NAME_TEMP_3', table='table_heritee';
run;
/* Ajouter une permission directe à la table qui surcharge l'héritage */
accessControl.addTableAcl / caslib='_NAME_TEMP_3', table='table_heritee', userId='sasguest', perm='promote';
/* Vérifier que la permission directe est active */
proc cas;
accessControl.showTableAcl / caslib='_NAME_TEMP_3', table='table_heritee';
run;
/* Réinitialiser la table aux permissions héritées */
accessControl.remAllAcsData / caslib='_NAME_TEMP_3', table='table_heritee';
/* Vérifier l'état après réinitialisation - la permission 'promote' devrait avoir disparu au niveau de la table */
proc cas;
accessControl.showTableAcl / caslib='_NAME_TEMP_3', table='table_heritee';
run;
/* Nettoyage */
proc cas;
table.dropTable / caslib='_NAME_TEMP_3', name='table_heritee';
caslib.dropCaslib / caslib='_NAME_TEMP_3';
run;
1
CAS casauto;
2
3
/* Création d'une caslib et d'une table */
4
caslib _NAME_TEMP_3 cas datasource=(srctype='path') path='/tmp/';
5
DATA _NAME_TEMP_3.table_heritee;
6
x=1; y=2;
7
RUN;
8
9
/* Afficher les permissions initiales de la caslib et de la table */
Explanation : This example focuses on robustness and error handling. It first attempts to apply `remAllAcsData` to a non-existent table to demonstrate how the system handles such situations (usually by returning an error code). Then, a table is created, permissions are applied, and then reset to show the correct operation of the action on a valid resource. This helps in understanding expected behaviors in less-than-ideal scenarios.
Copied!
CAS casauto;
/* Création d'une caslib temporaire */
caslib _NAME_TEMP_4 cas datasource=(srctype='path') path='/tmp/';
/* Tentative de réinitialisation sur une table qui n'existe pas */
proc cas;
accessControl.remAllAcsData / caslib='_NAME_TEMP_4', table='table_inexistante';
if _STATUS_ ne 0 then do;
print 'Erreur: La table n\'existe pas ou une autre erreur s\'est produite.';
end;
run;
/* Création d'une table et application de permissions */
data _NAME_TEMP_4.ma_table_err;
id=1;
name='Test';
run;
accessControl.addTableAcl / caslib='_NAME_TEMP_4', table='ma_table_err', userId='sasguest', perm='delete';
/* Réinitialisation réussie */
proc cas;
accessControl.remAllAcsData / caslib='_NAME_TEMP_4', table='ma_table_err';
run;
/* Nettoyage */
proc cas;
table.dropTable / caslib='_NAME_TEMP_4', name='ma_table_err';
caslib.dropCaslib / caslib='_NAME_TEMP_4';
run;
1
CAS casauto;
2
3
/* Création d'une caslib temporaire */
4
caslib _NAME_TEMP_4 cas datasource=(srctype='path') path='/tmp/';
5
6
/* Tentative de réinitialisation sur une table qui n'existe pas */
If you are automating a data promotion pipeline, include remAllAcsData as a standard cleanup step. This ensures that promoted tables always align with the production Caslib's security policy rather than carrying over experimental permissions from a sandbox.
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.