MCPcopy
hub / github.com/diffgram/diffgram / inner

Method inner

shared/permissions/super_admin_only.py:26–47  ·  view source on GitHub ↗
(*args, **kwds)

Source from the content-addressed store, hash-verified

24 def wrapper(func):
25 @wraps(func)
26 def inner(*args, **kwds):
27
28 with sessionMaker.session_scope() as session:
29
30 if LoggedIn() != True:
31 raise Unauthorized("No access.")
32
33 user = session.query(User).filter(User.id == getUserID(session = session)).first()
34
35 if user is None:
36 raise Unauthorized("No access.")
37
38 if allow_support is True:
39 if user.is_support_user() is True:
40 return func(*args, **kwds)
41
42 if user.is_super_admin == True:
43 return func(*args, **kwds)
44 else:
45 raise Forbidden("No access.")
46
47 raise Forbidden("No access.")
48
49 return inner
50

Callers

nothing calls this directly

Calls 3

LoggedInFunction · 0.90
getUserIDFunction · 0.90
is_support_userMethod · 0.80

Tested by

no test coverage detected