-
Notifications
You must be signed in to change notification settings - Fork 5
/
userrestrictrole.py
executable file
·104 lines (94 loc) · 3.28 KB
/
userrestrictrole.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Resource information of userrestrictrole
"""
def get_name(friendly=False):
"""Get name of this resource
:return: name of this resource
:rtype: str
"""
if friendly: # pragma: no cover
return "User role restriction"
return 'userrestrictrole'
def get_doc(): # pragma: no cover
"""Get documentation of this resource
:return: rst string
:rtype: str
"""
return """
The ``userrestrictrole`` model is an internal data model used to define the CRUD
rights for an Alignak backend user.
This allows to defined, for a user and a given realm, the create, read, update, and
delete rights on each backend endpoint.
"""
def get_schema():
"""Schema structure of this resource
:return: schema dictionary
:rtype: dict
"""
return {
'schema': {
'schema_version': {
'type': 'integer',
'default': 1,
},
'user': {
'schema_version': 1,
'title': 'Concerned user',
'type': 'objectid',
'data_relation': {
'resource': 'user',
'embeddable': True
},
'required': True,
},
'realm': {
'schema_version': 1,
'title': 'Concerned realm',
'type': 'objectid',
'data_relation': {
'resource': 'realm',
'embeddable': True
},
'required': True,
},
'sub_realm': {
'schema_version': 1,
'title': 'Sub-realms',
'comment': 'Is this right applicable to the sub-realms of the realm?',
'type': 'boolean',
'default': False
},
'resource': {
'schema_version': 1,
'title': 'Concerned resource',
'comment': 'Resource concerned with the right',
'type': 'string',
'default': '*',
'allowed': [
'*',
'actionacknowledge', 'actiondowntime', 'actionforcecheck',
'alignak', 'alignakdaemon',
'realm', 'command', 'timeperiod',
'user', 'usergroup', 'userrestrictrole',
'host', 'hostgroup', 'hostdependency', 'hostescalation',
'service', 'servicegroup', 'servicedependency', 'serviceescalation',
'grafana', 'graphite', 'influxdb', 'statsd',
'timeseriesretention', 'aligank_notifications',
'livesynthesis', 'livesynthesisretention',
'logcheckresult', 'history'
],
},
'crud': {
'schema_version': 1,
'title': 'Right',
'comment': "User's right for the concerned resource in the concerned realm. "
"Use ``*`` if all resources are concerned.",
'type': 'list',
'default': ['read'],
'allowed': ['create', 'read', 'update', 'delete', 'custom']
},
},
'schema_deleted': {}
}