logo

Invalid permission debug

If you encounter an auth.invalid_permission error, the problem is that Barong doesn't have permissions for this endpoint. To investigate the issue, connect to Barong using bundle exec rails console and run the following command:

Permission.find_by(role: '*ROLE_OF_USER*', path: '*ENDPOINT*')
Permission creation

You should create permission for this endpoint. Here is two way for creating it:

  • Create a permission from the Tower admin panel.

  • Create a permission using rails console:

    Permission.create!(action: '*ACTION*', role: 'ROLE_OF_USER', verb: '*METHOD*', path: '*ENDPOINT*')
    

    Available values for the action field:

    • accept - will provide access to endpoint.
    • drop - will restrict access to endpoint.
    • audit - will save activity for endpoint (NOTICE: audit value doesn't grant access to endpoint).

    Available values for the verb field: all, get, post, put, delete.

    After the permission was created, you'd need to clear the Rails cache by running the following command:

    Rails.cache.delete('permissions')
    
Permission refresh

To refresh Barong permissions you'd need to clear the Rails cache, by running the following command:

Rails.cache.delete('permissions')

Please contact [email protected], if the problem persists after the aforementioned actions.