rasenmaeher_api.db.people
Abstractions for people
Module Contents
Classes
People, pk is UUID and comes from basemodel |
|
Give a person a role |
Functions
|
Wrapper to be more DRY in the basic CRUD things |
|
New user was created |
|
Old user was revoked |
|
Old user was promoted to admin (granted role 'admin') |
|
Old user was demoted from admin (removed role 'admin') |
Attributes
- class Person[source]
Bases:
rasenmaeher_api.db.base.ORMBaseModel
People, pk is UUID and comes from basemodel
NOTE: at some point we want to stop keeping track of people in our own db and only use keycloack as the store for actual users. In any case we need a nice pythonic abstraction layer so implement any queries you need to add as helpers here.
- property productapidata: libpvarki.schemas.product.UserCRUDRequest[source]
Return a model that is usable with the product integration APIs
- Return type:
libpvarki.schemas.product.UserCRUDRequest
- property privkeyfile: pathlib.Path[source]
Path to the private key
- Return type:
- property pfxfile: pathlib.Path[source]
Return a PKCS12 PFX file
- Return type:
- property certfile: pathlib.Path[source]
Path to the public cert
- Return type:
- property csrfile: pathlib.Path[source]
Path to the CSR file
- Return type:
- property pubkeyfile: pathlib.Path[source]
Path to the public key
- Return type:
- async classmethod by_pk_or_callsign(inval, allow_deleted=False)[source]
Get person by pk or by callsign
- async classmethod create_with_cert(callsign, extra=None)[source]
Create the cert etc and save the person
- async revoke(reason)[source]
Revokes the cert with given reason and makes user deleted see validate_reason for info on reasons
- Parameters:
reason (rasenmaeher_api.cfssl.private.ReasonTypes)
- Return type:
- async classmethod by_role(role)[source]
List people that have given role, if role is None list all people
- async classmethod by_mtlsjwt_payload(payload, allow_deleted=False)[source]
Get by MTLSorJWTMiddleWare payload
- Parameters:
payload (rasenmaeher_api.web.api.middleware.datatypes.MTLSorJWTPayload)
allow_deleted (bool)
- Return type:
Self
- get_cert_pfx()[source]
Read the cert and private key from under certspath and return the PFX container
- Return type:
- async assign_role(role)[source]
Assign a role, return true if role was created, false if it already existed
- class Role[source]
Bases:
rasenmaeher_api.db.base.DBModel
Give a person a role
- async post_user_crud(userinfo, endpoint_suffix)[source]
Wrapper to be more DRY in the basic CRUD things
- Parameters:
userinfo (libpvarki.schemas.product.UserCRUDRequest)
endpoint_suffix (str)
- Return type:
None
- async user_created(person)[source]
New user was created
- Parameters:
person (Person)
- Return type:
None
- async user_revoked(person)[source]
Old user was revoked
- Parameters:
person (Person)
- Return type:
None