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

Class UserDB

st2common/st2common/models/db/auth.py:31–65  ·  view source on GitHub ↗

An entity representing system user. Attribute: name: Username. Also used as a primary key and foreign key when referencing users in other models. is_service: True if this is a service account. nicknames: Nickname + origin pairs for ChatOps auth.

Source from the content-addressed store, hash-verified

29
30
31class UserDB(stormbase.StormFoundationDB):
32 """
33 An entity representing system user.
34
35 Attribute:
36 name: Username. Also used as a primary key and foreign key when referencing users in other
37 models.
38 is_service: True if this is a service account.
39 nicknames: Nickname + origin pairs for ChatOps auth.
40 """
41
42 name = me.StringField(required=True, unique=True)
43 is_service = me.BooleanField(required=True, default=False)
44 nicknames = me.DictField(
45 required=False, help_text='"Nickname + origin" pairs for ChatOps auth'
46 )
47
48 def get_roles(self, include_remote=True):
49 """
50 Retrieve roles assigned to that user.
51
52 :param include_remote: True to also include remote role assignments.
53 :type include_remote: ``bool``
54
55 :rtype: ``list`` of :class:`RoleDB`
56 """
57 rbac_service = get_rbac_backend().get_service_class()
58 result = rbac_service.get_roles_for_user(
59 user_db=self, include_remote=include_remote
60 )
61 return result
62
63 def get_permission_assignments(self):
64 # TODO
65 pass
66
67
68class TokenDB(stormbase.StormFoundationDB):

Callers 15

handle_authMethod · 0.90
mock_get_by_nameFunction · 0.90
test_auth.pyFile · 0.90
postMethod · 0.90
putMethod · 0.90
get_oneMethod · 0.90
get_allMethod · 0.90

Calls

no outgoing calls