How to restrict anonymous user from some forms in form io?

313 views Asked by At

Formio providing anonymous role id for access the form from formio. this is providing the data without login. so when we try to access "/form" endpoint we will get all forms. some forms we don't want to show . How to restrict the access to anonymous role id ?

/form : please check this end point

2

There are 2 answers

0
Shuhaib zahir On BEST ANSWER

if you create the forms and you have not explicitly mentioned the form access object . Anonymous Role Id will be automatically added to the form read access.

    export const FORM_ACCESS =[{
    type: "read_all",
    roles:  [CLIENT_ID,
    STAFF_REVIEWER_ID,
    STAFF_DESIGNER_ID
      ]
  }]

 newForm.access=FORM_ACCESS

you can edit the access and send it with form data. then it will consider the explicitly data

0
crystalthinker On

This is a default behaviour of forms in form.io, this happens if you create the forms and you have not explicitly mentioned the form access object . Anonymous Role Id will be automatically added to the form read access. To avoid this we are going to add a is form to be anonymous checkbox for formsflow.ai design page in the future releases to control this behaviour. You can explicitly pass the form access object and mention the role IDs you need for read access to get this working.