ToolJet/docs/versioned_docs/version-2.18.0/how-to/access-users-groups.md
Shubhendra Singh Chauhan 9f2ff94a12
[docs] platform 5.x (#7427)
* whtie label revamp

* minor changes

* updated beta info in copilot docs

* renamed gds to ds in overview doc of v2.15 onwards

* updated multienv: renamed gds to ds, updated screenshot

* updated multienv: app state description

* updated superadmin wrt new licensing updates

* licensing update: free trial

* updates in licensing

* changes after review

* [docs]updated restapi with bearer auth

* Update kubernetes-aks.md

* Update openshift.md

* Update ecs.md

* Update ecs.md

* Update kubernetes-gke.md

* Update kubernetes.md

* Update docker.md

* Update docker.md

* Update ecs.md

* Update google-cloud-run.md

* Update kubernetes-aks.md

* Update kubernetes-gke.md

* Update kubernetes.md

* Update openshift.md

* Update kubernetes-gke.md

* Update kubernetes-aks.md

* fixed ecs, removed heroku from 2.15 onwards

* updated digitalocean doc

* licensing doc changes and location

* Update digitalocean.md

* Update digitalocean.md

* added v2.18.0

---------

Co-authored-by: Adish M <44204658+adishM98@users.noreply.github.com>
2023-09-27 12:24:39 +05:30

2.3 KiB
Raw Blame History

id title
access-currentuser Enable/Disable a component using current user's property

Enable/Disable a component using current user's property

Let's take look at the exposed variables of the current user property:

  • email : The value can accessed using {{globals.currentUser.email}}
  • firstName : The value can accessed using {{globals.currentUser.firstName}}
  • lastName : The value can accessed using {{globals.currentUser.lastName}}
  • lastName : The value can accessed using {{globals.currentUser.lastName}}
  • groups : By default, the admin will be in the two groups all_users and admin, and any user who is not admin will always be in the all_users group by default. Since the groups is an array youll have to provide the index ([0], [1], and so on) to return the group name. The value can be accessed using {{globals.currentUser.groups[1]}}.
Properties of current user

Example: Disable a button if a user is not admin

  • Click on the Button handle to open its properties, on the Styles tab go to the Disable property.

    Properties of button
  • Set a condition on the Disable field so that if the the user who is using the app does not have admin value in the first index of groups array return true. The condition can be:

    {{globals.currentUser.groups[1] !== "admin" ? true : false}}
    
    Disable Property of button
  • Now, when you'll release the app, if the user is not is not admin the button will be disabled.

    Released button disabled when user is not admin

:::info In this how-to we have used the Groups property of the Current User. You can use any of the exposed variables mentioned above according to your use. :::