Determining whether the user is authenticated or not

We are implementing an app which contains some secure and some nonsecured pages.
We also have a custom implementation of user authentication.

We want to have a way to secure some server methods.

My question is do we have any such Anvil decorator that can secure the server method?

Something like:

def provide_secure_info():

return secure_data

You can easily create your own, similar to how I have done it in this post:

If all you really want is whether the user is logged in in any way, you can use the @anvil.server.callable() decorator itself with parameters.

# verify that a user is logged in using the Users Service

require_user can take a boolean value (as above), or a function. If given a function, that function will receive the currently logged-in user (the return value of anvil.users.get_user()).

From the docs here:


You might consider looking at the Authorisation module of Anvil Extras