Skip to content

RoleTraits class

Bases: ABC

Base class for role management in Taipy Enterprise.

Available in Taipy Enterprise only

This class exists only in the Enterprise edition of Taipy.

Role traits represent any value that the application can use to adapt its logic depending on the roles assigned to an authenticated user, stored in a Credentials instance.

The selection of role traits is performed by the get_traits() method. All predefined role traits are role traits filters: the selection of role traits depend on the configuration of the roles in the provided credentials. This selection is recursive: if the selected role traits are a role traits filter, then the filter is applied recursively until the role traits value is not a role traits filter.

See the Role Traits section for more information.

Methods

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
credentials 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.
An empty set is returned if credentials is not an instance of Credentials.