BookmarkSubscribeRSS Feed

SAS Studio global shortcuts, one option to control them all

Started ‎03-05-2024 by
Modified ‎03-05-2024 by
Views 331

A SAS Studio user can create his own shortcuts either for SAS content folders or for directories on the filesystem.

 

In this article we learn about, how an administrator can define shortcuts to SAS content folders or a directory on the filesystem for all users of SAS Studio.

 

The following topics are covered:

  • What are global shortcuts
  • How to define them
  • Use cases


What are global shortcuts

 

As already mentioned beside user defined shortcuts, an administrator can define global shortcuts for all users. Since this definition is on the SAS Studio level it will apply to all users of SAS Studio independent of the compute context being used.

 

Lets look how the SAS Studio user sees it:

 

bm_1_-sas-studio-shortcuts.png

Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.

 

As we can see from the image above, global shortcuts are decorated with a globe, so it is easy to distinguish them from the user defined shortcuts. These shortcut definitions (user defined or global) will be seen in the Explorer as well in the Open/Save dialog windows. They provide an easy way to folders/directories that are deeply nested.

 

How to define them

 

Using SAS Environment Manager

 

We first look at how we can define/update global shortcut definitions.

 

In SAS Environment Manager:

  1. We go to the Configuration page
  2. Search for the "SAS Studio" service
  3. Selected the SAS Studio service
  4. On the right side we collapse all configuration instance
  5. Click on the pencil icon for the "sas.studio" configuration instance

bm-2_sas-studio-shortcuts-configuration.png

 

 

A new window opens where we can see all the properties. We scroll down until we find the property "globalShortcuts".

 

bm-3_sas-studio-shortcuts-globalShortcuts.png

 

 

In the text field we can enter/update our shortcut definitions. Each global shortcut is defined by two lines. The lines are separated by a newline control character (\n). If you enter text in the above text field the proper newline is inserted automatically.

 

The first line is the label of the shortcut, this is the text seen in the Explorer pane in SAS Studio. The second line is the path:

  • For a filesystem path simply enter the directory name. Example: "/workshop".
  • For a SAS content path the line looks like "sascontent:<folderURI>".  Example: "sascontent:/folders/folders/3f6ab1b0-af34-46d0-8ce2-f735a4bc0a36". To determine the folderURI of a folder in SAS Content, see the URI field in SAS Drive, or use the Content page in SAS Environment Manager.

 

You cannot have any empty lines.

 

In order to see the new global shortcuts, Sign out/Sign in to SAS Studio.

 

Using the sas-viya CLI

 

The globalShortcuts property can also be set using the sas-viya configuration configurations update command.

 

Follow the steps below.

 

Get the id of the configuration instance

 

We do need this later to update a JSON file.

 

configId=$(sas-viya --output json configuration configurations list --service SASStudio --definition-name sas.studio | jq -r '.items[] | .id')

 

Prepare the needed JSON file for the update

 

Note the configId env var is used in the file. Please make sure that do you do not have any line breaks other than the "\n" in the text for the key globalShortcuts

 

tee ~/sas-studio-globalshortcuts.json > /dev/null << EOF
{
"version": 2, 
"accept": "application/vnd.sas.configuration.config+json", 
"name": "configurations", 
"items": [ 
{ 
"id": $configId, 
"metadata": { 
"isDefault": false, 
"mediaType": "application/vnd.sas.configuration.config.sas.studio+json;version=21", 
"services": [ 
"SASStudio", 
"studio" 
] 
}, 
"version": 1, 
"globalShortcuts": "A global (sc)\nsascontent:/folders/folders/a665eb32-5e39-43a5-a1f8-6e7823272a8f\nworkshop (fs)\n/workshop" 
} 
] 
} 
EOF

 

How does one know what the JSON file should look like? You can use this command sas-viya configuration configurations download --service SASStudio --definition-name sas.studio to download the complete configuration instance. Above I have only specified the minimum elements needed. You can edit the downloaded file and use it in the next step to set the new values. In this case the step to read the configuration id is not necessary.

 

Apply the change

sas-viya configuration configurations update --file ~/sas-studio-globalshortcuts.json

 

If everything goes according to plan, the following response is returned: "PATCH" "/configuration/configurations" complete from "/home/christine/sas-studio-globalshortcuts.json"

 

For debugging purposes you can add the --verbose option to the sas-viya command

 

Use cases

 

Here are a few use cases where global shortcuts provide benefits:

 

  • Make directories available for use even when the property "fileNavigationRoot" is set to USER meaning the SAS Studio user will only see his home directory.
  • Even when the filesystem access is switched off (property showServerFiles), a global shortcut gives you access to the defined directory.
  • Provide simplified navigation to common directories or SAS content folders that are otherwise nested several levels.

 

Summary

 

You have to be a SAS administrator to define global shortcuts. These shortcuts apply to all SAS Studio users. There is currently now way to define them for instance based on group membership or for an individual compute server context. We have seen some uses cases where global shortcuts do have some benefits. The shortcuts are displayed independent of permissions for the "path". So you might get an error message if you try to access a "path" where you do not have the proper permission.

 

References

 

SAS Studio configuration properties make sure to select the version that matches your SAS Viya.  

Comments

Excellent post ! Thanks for sharing. I wasn't aware that fs-based shortcuts might be enabled when filesystem access is switched off : it works like an AllowList access very easy to configure.

Version history
Last update:
‎03-05-2024 03:10 AM
Updated by:
Contributors

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags