Base Repositories
fastauth.repositories.AbstractUserRepository
user_model
instance-attribute
user_model
get_by_id
abstractmethod
async
get_by_id(pk)
Get user by id
PARAMETER | DESCRIPTION |
---|---|
pk
|
User id
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
UP | None
|
User model or None |
Source code in fastauth/repositories.py
12 13 14 15 16 17 18 19 |
|
get_by_email
abstractmethod
async
get_by_email(email)
Get user by email
PARAMETER | DESCRIPTION |
---|---|
email
|
User email
TYPE:
|
Source code in fastauth/repositories.py
21 22 23 24 25 26 27 28 29 |
|
get_by_username
abstractmethod
async
get_by_username(username)
Get user by email
PARAMETER | DESCRIPTION |
---|---|
username
|
User username
TYPE:
|
Source code in fastauth/repositories.py
31 32 33 34 35 36 37 38 |
|
get_by_fields
abstractmethod
async
get_by_fields(value, fields)
Get user by multiple fields and username. Just check in cycle if user.
PARAMETER | DESCRIPTION |
---|---|
value
|
User field value
TYPE:
|
fields
|
list of fields on user model
TYPE:
|
Source code in fastauth/repositories.py
40 41 42 43 44 45 46 47 48 |
|
get_by_field
abstractmethod
async
get_by_field(value, field)
Get user by his value in field
PARAMETER | DESCRIPTION |
---|---|
value
|
User model field value
TYPE:
|
field
|
User model field name
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
UP | None
|
User model or None |
Source code in fastauth/repositories.py
50 51 52 53 54 55 56 57 58 |
|
create
abstractmethod
async
create(data)
Create User in DB from data dict
PARAMETER | DESCRIPTION |
---|---|
data
|
User model payload
TYPE:
|
Source code in fastauth/repositories.py
60 61 62 63 64 65 66 67 |
|
update
abstractmethod
async
update(user, data)
Update provided user model with provided data
PARAMETER | DESCRIPTION |
---|---|
user
|
User model
TYPE:
|
data
|
Data with which updates user
TYPE:
|
Source code in fastauth/repositories.py
69 70 71 72 73 74 75 76 77 |
|
delete
abstractmethod
async
delete(user)
Delete provided user model from db
PARAMETER | DESCRIPTION |
---|---|
user
|
User model
TYPE:
|
Source code in fastauth/repositories.py
79 80 81 82 83 84 85 86 |
|
fastauth.repositories.AbstractRolePermissionRepository
role_model
instance-attribute
role_model
permission_model
instance-attribute
permission_model
get_role
abstractmethod
async
get_role(role_id)
Ger role by id
PARAMETER | DESCRIPTION |
---|---|
role_id
|
INTEGER Primary key
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
RP | None
|
Role model |
Source code in fastauth/repositories.py
93 94 95 96 97 98 99 100 101 |
|
get_role_by_codename
abstractmethod
async
get_role_by_codename(codename)
Ger role by codename
PARAMETER | DESCRIPTION |
---|---|
codename
|
Role codename
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
RP | None
|
Role model |
Source code in fastauth/repositories.py
103 104 105 106 107 108 109 110 |
|
create_role
abstractmethod
async
create_role(data)
Create new role in db from data dict
PARAMETER | DESCRIPTION |
---|---|
data
|
Role model payload
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
RP
|
New Role model |
Source code in fastauth/repositories.py
112 113 114 115 116 117 118 119 |
|
update_role
abstractmethod
async
update_role(role, data)
Update provided role model with provided data
PARAMETER | DESCRIPTION |
---|---|
role
|
Role model
TYPE:
|
data
|
Data with which updates role
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
RP
|
Updated role model |
Source code in fastauth/repositories.py
121 122 123 124 125 126 127 128 129 |
|
delete_role
abstractmethod
async
delete_role(role)
Delete provided role model from db
PARAMETER | DESCRIPTION |
---|---|
role
|
Role model
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
None
|
None |
Source code in fastauth/repositories.py
131 132 133 134 135 136 137 138 |
|
list_roles
abstractmethod
async
list_roles()
List all roles
RETURNS | DESCRIPTION |
---|---|
list[RP]
|
List of Role models |
Source code in fastauth/repositories.py
140 141 142 143 144 145 146 |
|
get_permission
abstractmethod
async
get_permission(permission_id)
Get permission by id
PARAMETER | DESCRIPTION |
---|---|
permission_id
|
INTEGER Primary key
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
PP | None
|
Permission model |
Source code in fastauth/repositories.py
148 149 150 151 152 153 154 155 |
|
get_permission_by_codename
abstractmethod
async
get_permission_by_codename(codename)
Get permission by codename
PARAMETER | DESCRIPTION |
---|---|
codename
|
Permission codename
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
PP | None
|
Permission model |
Source code in fastauth/repositories.py
157 158 159 160 161 162 163 164 |
|
create_permission
abstractmethod
async
create_permission(data)
Create new permission in db from data dict
PARAMETER | DESCRIPTION |
---|---|
data
|
Permission model payload
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
PP
|
New Permission model |
Source code in fastauth/repositories.py
166 167 168 169 170 171 172 173 |
|
update_permission
abstractmethod
async
update_permission(permission, data)
Update provided permission model with provided data
PARAMETER | DESCRIPTION |
---|---|
permission
|
Permission model
TYPE:
|
data
|
Data with which updates permission
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
PP
|
Updated permission model |
Source code in fastauth/repositories.py
175 176 177 178 179 180 181 182 183 |
|
delete_permission
abstractmethod
async
delete_permission(permission)
Delete provided permission model from db
PARAMETER | DESCRIPTION |
---|---|
permission
|
Permission model
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
None
|
None |
Source code in fastauth/repositories.py
185 186 187 188 189 190 191 192 |
|
list_permissions
abstractmethod
async
list_permissions()
List all permissions
RETURNS | DESCRIPTION |
---|---|
list[PP]
|
List of Permission models |
Source code in fastauth/repositories.py
194 195 196 197 198 199 200 |
|
fastauth.repositories.AbstractOAuthRepository
Bases: Generic[UOAP, OAP]
, ABC
user_model
instance-attribute
user_model
oauth_model
instance-attribute
oauth_model
get_user
abstractmethod
async
get_user(oauth_name, account_id)
Get user by oauth account name and id
PARAMETER | DESCRIPTION |
---|---|
oauth_name
|
OAuth client name
TYPE:
|
account_id
|
OAuthAccount model PK
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
UOAP | None
|
User model |
Source code in fastauth/repositories.py
207 208 209 210 211 212 213 214 215 |
|
add_oauth_account
abstractmethod
async
add_oauth_account(user, data)
Create a new OAuth account and add it to User model
PARAMETER | DESCRIPTION |
---|---|
user
|
User model
TYPE:
|
data
|
OAuth Account data
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
UOAP
|
User model |
Source code in fastauth/repositories.py
217 218 219 220 221 222 223 224 225 |
|
update_oauth_account
abstractmethod
async
update_oauth_account(user, oauth, data)
Update provided OAuth account with provided data, and refresh user in DB
PARAMETER | DESCRIPTION |
---|---|
user
|
User model
TYPE:
|
oauth
|
OAuthAccount model
TYPE:
|
data
|
Data with which updates OAuth account
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
UOAP
|
Updated User model |
Source code in fastauth/repositories.py
227 228 229 230 231 232 233 234 235 236 237 238 |
|