How to check if the user switched to Administrative Access mode? #21153
-
I created a plugin for Cockpit which requires root user or at least The developers guide mentions the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I.e. you want your page to show an alert or similar when not in privileged mode? This is quite common indeed. We have a little superuser.js library (which you can pull in from cockpit like starter-kit does, or just copy). This has a cockpit.permission is older code, and TBH I'm not sure right now how superuser.js is "better" -- but this should also work:
|
Beta Was this translation helpful? Give feedback.
I.e. you want your page to show an alert or similar when not in privileged mode? This is quite common indeed. We have a little superuser.js library (which you can pull in from cockpit like starter-kit does, or just copy). This has a
superuser.allowed
boolean(ish) property, and also a callback when the superuser state changes, so that you page can react.cockpit.permission is older code, and TBH I'm not sure right now how superuser.js is "better" -- but this should also work: