adhocracy_core.resources.principal module¶
Principal types (user/group) and helpers to search/get user information.
-
interface
IPrincipalsService[source]¶ Extends:
adhocracy_core.interfaces.IServicePoolService Pool representing a collection of principals.
If the object is created via
substanced.content.ContentRegistry.create(), it will contain three sub services:users: an instance of the content type
IUsersgroup: an instance of the content type
Groupsresets: an instance of the content type
Password Resets
-
create_initial_content_for_principals(context: <InterfaceClass adhocracy_core.interfaces.IPool>, registry: pyramid.registry.Registry, options: dict)[source]¶ Add users, groups and resets subobjects to context.
-
interface
IUser[source]¶ Extends:
adhocracy_core.interfaces.IPoolUser resource.
This inherits from IPool in order to allow to use this resource as a namespace for user objects.
-
active¶ Whether the user account has been activated (bool)
-
activation_path¶ Activation path for not-yet-activated accounts (str)
-
-
class
User(data=None, family=None)[source]¶ Bases:
adhocracy_core.resources.pool.PoolUser implementation.
With attributes to be compatible with
substanced.principals.UserInitialize self.
-
tzname= 'UTC'¶
-
password= ''¶
-
email= ''¶
-
name= ''¶
-
active= False¶
-
activation_path= None¶
-
timezone¶
-
-
interface
ISystemUser[source]¶ Extends:
adhocracy_core.resources.principal.IUserUser resource without login/password, created by the application.
-
allow_create_asset_authenticated(context: <InterfaceClass adhocracy_core.interfaces.IPool>, registry: pyramid.registry.Registry, options: dict)[source]¶ Set local permission to create assets for authenticated.
This is needed to assure user can create their user image.
-
sdi_user_columns(folder, subobject, request, default_columnspec)[source]¶ Mapping function to add info columns to the sdi user listing.
-
interface
IUsersService[source]¶ Extends:
adhocracy_core.interfaces.IServicePoolService Pool for Users.
-
interface
IGroup[source]¶ Extends:
adhocracy_core.interfaces.IPoolGroup for Users.
-
class
Group(data=None, family=None)[source]¶ Bases:
adhocracy_core.resources.pool.PoolGroup implementation with roles attribute to improve performance.
Initialize self.
-
interface
IGroupsService[source]¶ Extends:
adhocracy_core.interfaces.IServicePoolPool for Groups.
-
deny_view_permission(context: <InterfaceClass adhocracy_core.interfaces.IResource>, registry: pyramid.registry.Registry, options: dict)[source]¶ Remove view permission for everyone for context.
-
hide(context: <InterfaceClass adhocracy_core.interfaces.IResource>, registry: pyramid.registry.Registry, options: dict)[source]¶ Hide context.
-
interface
IPasswordReset[source]¶ Extends:
adhocracy_core.interfaces.IResourceResource to do one user password reset.
-
class
PasswordReset[source]¶ Bases:
adhocracy_core.resources.base.BasePassword reset implementation.
Initialize self.
-
interface
IPasswordResetsService[source]¶ Extends:
adhocracy_core.interfaces.IServicePoolService Pool for Password Resets.
-
class
UserLocatorAdapter(context, request)[source]¶ Bases:
objectProvides helper methods to find users.
Initialize self.
-
get_user_by_login(login: str) → <InterfaceClass adhocracy_core.resources.principal.IUser>[source]¶ Find user per login name or return None.
-
get_users() → [<InterfaceClass adhocracy_core.resources.principal.IUser>][source]¶ Return all users.
-
get_user_by_userid(userid: str) → <InterfaceClass adhocracy_core.resources.principal.IUser>[source]¶ Find user by userid or return None.
-
get_user_by_email(email: str) → <InterfaceClass adhocracy_core.resources.principal.IUser>[source]¶ Find user per email or return None.
-
get_user_by_activation_path(activation_path: str) → <InterfaceClass adhocracy_core.resources.principal.IUser>[source]¶ Find user per activation path or return None.
-
get_user_by_service_konto_userid(userid: str) → <InterfaceClass adhocracy_core.resources.principal.IUser>[source]¶ Find user per service konto userid or return None.
-
get_groups(userid: str) → [<InterfaceClass adhocracy_core.resources.principal.IGroup>][source]¶ Get groups for term:userid or return None.
-
-
get_user_or_anonymous(request: pyramid.request.Request) → <InterfaceClass adhocracy_core.resources.principal.IUser>[source]¶ Get authenticated user or anonymous if anonymized request or None.
Meant to be use as request method ‘user’.
-
get_system_user_anonymous(request: pyramid.request.Request) → <InterfaceClass adhocracy_core.resources.principal.IUser>[source]¶ Return user used to anonymize other users.
-
get_anonymized_user(request: pyramid.request.Request) → <InterfaceClass adhocracy_core.resources.principal.IUser>[source]¶ Get authenticated user if anonymized request or None.
Meant to be use as request method ‘anonymized_user’.
-
groups_and_roles_finder(userid: str, request: pyramid.request.Request) → list[source]¶ A Pyramid authentication policy groupfinder callback.
-
delete_not_activated_users(request: pyramid.request.Request, age_in_days: int)[source]¶ Delete not activate users that are older than age_in_days.