Announcement

Collapse
No announcement yet.

Read-only field based on current logged user role

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Read-only field based on current logged user role

    HI!
    Is it possible to make entity field read-only only when current logged user role is different from Admin?
    Thank you in advance

  • #2
    In v8.1 it will be possible to define dynamic logic based on specific users or user teams. No admin check though.

    Comment


    • #3
      Originally posted by yuri View Post
      In v8.1 it will be possible to define dynamic logic based on specific users or user teams. No admin check though.
      Great, when do you plan to release version 8.1?

      Comment


      • yuri
        yuri commented
        Editing a comment
        In ~1.5 months.

    • #4
      If you don't mind coding, you can use a dynamic handler to set any conditions that you want.

      Comment


      • llen
        llen commented
        Editing a comment
        hi, I have tried using Dynamic Handler , but I am confused about how to retrieve the logged in user role.

    • #5
      hi, I have tried using Dynamic Handler , but I am confused about how to retrieve the logged in user role. this is my code
      Attached Files

      Comment


      • rabii
        rabii commented
        Editing a comment
        you can check if current user is not admin like below
        !this.recordView.getUser().isAdmin()

    • #6
      > how to retrieve the logged in user role

      Code:
      this.recordsView.getUser().get('type') === 'admin'
      or checking teams:

      Code:
      this.recordsView.getUser().get('teamsIds').includes('someTeamId')

      Comment


      • llen
        llen commented
        Editing a comment
        I think type is not the role. The role I mean is the role in the role in database table while the type is user level and it is not a role

      • yuri
        yuri commented
        Editing a comment
        Making an assumption from the initial question, kacper meant admin/non-admin. These are not roles, but the type. Checking roles does not make sense from the Espo ACL design point of view. One should never check user roles.

    • #7
      Thanks!

      Comment


      • #8
        I have successfully retrieved the logged in user role, just by adding the role information into the user getRoles() api

        Comment

        Working...
        X