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

Function _derive_scope_and_key

st2common/st2common/util/keyvalue.py:65–79  ·  view source on GitHub ↗

:param user: Name of the user. :type user: ``str``

(key, user, scope=None)

Source from the content-addressed store, hash-verified

63
64
65def _derive_scope_and_key(key, user, scope=None):
66 """
67 :param user: Name of the user.
68 :type user: ``str``
69 """
70 if user and not isinstance(user, six.string_types):
71 raise TypeError('"user" needs to be a string')
72
73 if scope is not None:
74 return scope, key
75
76 if key.startswith("system."):
77 return FULL_SYSTEM_SCOPE, key[key.index(".") + 1 :]
78
79 return FULL_USER_SCOPE, "%s:%s" % (user, key)
80
81
82def get_key(key=None, user_db=None, scope=None, decrypt=False):

Callers 1

get_keyFunction · 0.85

Calls 1

indexMethod · 0.80

Tested by

no test coverage detected