Access Based Form View

How can I hide the form view based on user access?

For example: if I register with user1

  • I see all clients (created by me and user2) in the kanban tree views.
  • Only my clients see the form submission.
+3


source to share


2 answers


I think the only way to achieve this is to update the form itself. You would put all the content in div

and hide it if user_id

(or whatever field you want to set the rule to) is someone else.

Effectively, it would look something like this:

<div attrs="{'invisible': [('user_id', '!=', user.id)]}">
    # normal form view fields and formatting
</div>

      



If a field is user_id

not used as the default for a logged in user, it is possible that form fields will be hidden by default when a new record is created. You could work around it with something like this (which allows you to see entries that are not assigned to a user):

<div attrs="{'invisible': [('user_id', 'not in', [user.id, False])]}">

      

0


source


To do this, you need to make two groups. The first is for the administrator and the second is for the users.

In kanban and tree, you have to grant field admin rights or apply group 1 to the tree and kanban view.



In the form view, you have to provide a second group, so it works great as per your requirement.

0


source







All Articles