Polished is an R package that adds authentication and user administration to your Shiny apps. We continue to push forward with new improvements and are happy to introduce a new feature:
Under the hood, user roles are just strings that you define in your polished.tech dashboard. e.g. you can make a “super_user” role. You can then assign the “super_user” role to 1 or more users of your
Shiny app. Then the next time the user signs in to your
Shiny app they will have this “super_user” role on their
session$userData$user()$roles vector that is made available by
polished. You can then check the user’s roles to allow/restrict access to different aspects of your app.
As another example, let’s say you have a table of data stored in your
Shiny app. You want to grant some users the ability to add and edit data, while the rest of your users should only be able to view the data. You can use polished’s roles to create an “editor” role, and then assign that role to select users. You can then use the existance of this “editor” role to programmatically allow/restrict adding and editing data.
You may create as many roles as you need. The following is the step my step process for how to create roles in the polished dashboard, and add them to your user:
- Go to the “Manage Roles” tab and click the “Add Role” button (top left) to create the “editor” role.
- Click the blue button on the same row as your newly created “editor” role to assign users to the role. Here I assigned myself to the role of editor.
- From within your Shiny app that is using
polished, check your users’ roles to enable/disable certain features of your app.
As noted earlier, you can access your users’ roles in the user object provided by polished at:
Here is a Shiny app using the polshed “editor” role that we created above:
This is a simple feature, but we have found it helps keep our apps consistent and well
If you want to check out roles and other new features today, sign up for an account at polished.tech. And make sure to install the newly released
0.2.0 version of polished from CRAN with:
Please reach out if you have questions or feedback!