Skip to content

Authentication & Authorization #262

Answered by rhurlbatt
ralixit asked this question in Q&A
Discussion options

You must be logged in to vote

I have been using this module with great results.

As per the docs , you do not need to pass the function name to the decorator, simply decorate the function as per below.

@anvil.server.callable
@authentication_required
def sensitive_server_function():
  do_stuff()

For the @authorisation_required decorator, you must have followed the instructions below and have the necessary roles and permissions tables set up and linked correctly. Then decorate the function with the appropriate 'role' string (can_edit_sensitive_thing).

@anvil.server.callable
@authorisation_required("can_edit_sensitive_thing")
def sensitive_server_function():
  do_stuff()

Have you done this?
Can you provide a clone link …

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@antletem
Comment options

Answer selected by meatballs
Comment options

You must be logged in to vote
3 replies
@antletem
Comment options

@meatballs
Comment options

@antletem
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants