mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
aurweb.auth: add user credentials and matcher functions
This clones the behavior already present in the PHP implementation, but it uses a global dict with credential constant keys to validation functions to determine if a given user has a credential. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
670f711b59
commit
07d5907ecd
4 changed files with 154 additions and 1 deletions
|
@ -141,6 +141,11 @@ class User:
|
|||
request.cookies["AURSID"] = self.session.SessionID
|
||||
return self.session.SessionID
|
||||
|
||||
def has_credential(self, credential: str, approved: list = tuple()):
|
||||
import aurweb.auth
|
||||
cred = getattr(aurweb.auth, credential)
|
||||
return aurweb.auth.has_credential(self, cred, approved)
|
||||
|
||||
def logout(self, request):
|
||||
from aurweb.db import session
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue