MCPcopy Create free account
hub / github.com/StackStorm/st2 / _validate_decrypt_query_parameter

Function _validate_decrypt_query_parameter

st2common/st2common/util/keyvalue.py:44–52  ·  view source on GitHub ↗

Validate that the provider user is either admin or requesting to decrypt value for themselves.

(decrypt, scope, is_admin, user_db)

Source from the content-addressed store, hash-verified

42
43
44def _validate_decrypt_query_parameter(decrypt, scope, is_admin, user_db):
45 """
46 Validate that the provider user is either admin or requesting to decrypt value for
47 themselves.
48 """
49 is_user_scope = scope == USER_SCOPE or scope == FULL_USER_SCOPE
50 if decrypt and (not is_user_scope and not is_admin):
51 msg = "Decrypt option requires administrator access"
52 raise AccessDeniedError(message=msg, user_db=user_db)
53
54
55def get_datastore_full_scope(scope):

Callers

nothing calls this directly

Calls 1

AccessDeniedErrorClass · 0.90

Tested by

no test coverage detected