IsAuthenticated class
Bases: RoleTraitsFilter
Select traits depending on whether the user is authenticated or not.
Available in Taipy Enterprise only
This class exists only in the Enterprise edition of Taipy.
IsAuthenticated
is a role traits filter that recursively selects role traits
depending on the user roles: get_traits()
returns the success value
if the credentials are valid and failure if they're not.
Example
You can create an IsAuthenticated
role traits filter with the following code:
my_filter = IsAuthenticated("User is authenticated", "User is not authenticated")
Methods¶
__init__() ¶
__init__(
success: Optional[Union[RoleTraits, Any]],
failure: Optional[Union[RoleTraits, Any]] = None,
) -> None
Initialize a None Role Traits filter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Optional[Union[RoleTraits, Any]]
|
The role traits that are returned if the user is authenticated. |
required |
|
Optional[Union[RoleTraits, Any]]
|
The role traits that are returned if the user is not authenticated. |
None
|
get_traits() ¶
get_traits(credentials: Optional[Credentials]) -> Any
Return the role traits for the indicated credentials.
This method is recursive: role traits filters (see AnyOf
, AllOf
or
NoneOf
) can hold both a role traits value, that the application can use
in its logic, or a RoleTraits
instance. In this latter case, this role
traits filter is processed for further role traits selection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Optional[Credentials]
|
The credentials that are used to compute the roles traits. |
required |
Returns:
Name | Type | Description |
---|---|---|
Any |
Any
|
The role traits corresponding to the roles held in credentials. |