magpie.api.management.user¶
Submodules¶
Attributes¶
Classes¶
Used to build base Access Control List (ACL) of the request user. |
Functions¶
|
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when |
|
Package Contents¶
- class magpie.api.management.user.UserFactory(request: pyramid.request.Request)[source]¶
Bases:
RootFactoryUsed to build base Access Control List (ACL) of the request user.
All API and UI routes will employ this set of effective principals to determine if the user is authorized to access the pyramid view according to the
permissionvalue it was configured with.Note
Keep in mind that Magpie is configured with default permission
magpie.constants.MAGPIE_ADMIN_PERMISSION. Views that require more permissive authorization must be overridden withpermissionargument.See also
set_default_permissionwithinmagpie.includeme()initialization steps
- __getitem__(user_name: magpie.typedefs.Str) UserFactory[source]¶
- property __acl__: magpie.typedefs.AccessControlListType¶
Grant access to Request User according to its relationship to Context User.
If it is the same user (either from explicit name or by
magpie.constants.MAGPIE_LOGGED_USERreserved keyword), allowmagpie.constants.MAGPIE_LOGGED_PERMISSIONfor itself to access corresponding views.If request user is unauthenticated (
None),magpie.constants.MAGPIE_LOGGED_USERor itself, also grantmagpie.constants.MAGPIE_CONTEXT_PERMISSIONto allow access to contextually-available details (e.g.: user can view his own information and public ones).All ACL permissions from
RootFactoryare applied on top of user-specific permissions added here.
- magpie.api.management.user.get_logger(name: magpie.typedefs.Str, level: int | None = None, force_stdout: bool = None, message_format: magpie.typedefs.Str | None = None, datetime_format: magpie.typedefs.Str | None = None) logging.Logger[source]¶
Immediately sets the logger level to avoid duplicate log outputs from the root logger and this logger when level is
logging.NOTSET.