Scénario de test & Cas d'usage
Management of access rights and data security.
Discover all actions of accessControlSimulate a scenario with an active user ('active_user_empty') who has no tables in their personal caslib. We will also test against a user ('inactive_user') who does not have an active CAS session.
| 1 | /* No |
| 2 | data setup is required. The test relies on the state of user sessions and their caslibs (or lack thereof). We assume 'active_user_empty' has a |
| 3 | session and 'inactive_user' does not. */ |
| 1 | |
| 2 | PROC CAS; |
| 3 | ACCESSCONTROL.accessPersonalCaslibs; |
| 4 | RUN; |
| 5 |
| 1 | PROC CAS; |
| 2 | /* Should run without error and produce an empty table list */ |
| 3 | TABLE.tableInfo / caslib="CASUSER(active_user_empty)"; |
| 4 | RUN; |
| 1 | PROC CAS; |
| 2 | /* Should fail with a 'caslib not found' error, not 'access denied' */ |
| 3 | TABLE.tableInfo / caslib="CASUSER(inactive_user)"; |
| 4 | RUN; |
The test demonstrates the robustness of an administrative script. The action on the empty caslib succeeds, preventing the script from failing unnecessarily. The action on the non-existent caslib fails with a predictable 'not found' error, which can be trapped and handled by the script, rather than an untrappable authorization error. This confirms the action behaves correctly in edge-case scenarios.