Select traits depending on whether none of the user roles belong to the filter or not.
Available in Taipy Enterprise only
This class exists only in the Enterprise edition of Taipy.
NoneOf is a role traits filter that recursively selects role traits
depending on the user roles:
get_traits() returns the success value
if the credentials do not hold any of the filter roles and failure if they do.
You can create an
NoneOf role traits filter with the following code:
my_filter = NoneOf(["role1", "role2"], "No role is present")
Let's pretend that a user is identified by the
- If the credentials hold any of "role1" or "role2", then
my_filter.get_traits(credentials)returns None, which is the default value for the failure case.
- If the credentials hold any set of roles except "role1" or "role2", then
my_filter.get_traits(credentials)returns the string "No role is present", which is the value that was set for the success case.
__init__(filters, success, failure=None)
Initialize a None Role Traits filter.
The role or set of roles to filter.
The role traits that are returned if none of the user roles appear in filters, if the user has no roles or if filters is empty.
The role traits that are returned if any of the user roles exists in filters.