api: properly compute authorization based on ccchh role
This commit is contained in:
parent
188002b3f3
commit
bf0c085739
3 changed files with 10 additions and 8 deletions
|
|
@ -33,17 +33,18 @@ class CurrentUser(BaseModel):
|
|||
|
||||
@property
|
||||
def ccchh_roles(self) -> List[str]:
|
||||
return []
|
||||
return getattr(self.id_token, "ccchh-roles", [])
|
||||
|
||||
@property
|
||||
def may_operate_locks(self) -> bool:
|
||||
return True
|
||||
return "intern@" in self.ccchh_roles
|
||||
|
||||
|
||||
class UserStatus(BaseModel):
|
||||
is_authorized: bool
|
||||
guaranteed_session_until: Optional[datetime]
|
||||
username: Optional[str]
|
||||
guaranteed_session_until: datetime
|
||||
username: str
|
||||
ccchh_roles: List[str]
|
||||
|
||||
|
||||
class LockStatus(BaseModel):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue