git://git.onelab.eu
/
plcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tabs vs. spaces.
[plcapi.git]
/
PLC
/
Methods
/
AdmGetAllRoles.py
diff --git
a/PLC/Methods/AdmGetAllRoles.py
b/PLC/Methods/AdmGetAllRoles.py
index
6a80dd3
..
2b88714
100644
(file)
--- a/
PLC/Methods/AdmGetAllRoles.py
+++ b/
PLC/Methods/AdmGetAllRoles.py
@@
-1,11
+1,13
@@
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter
from PLC.Faults import *
from PLC.Method import Method
from PLC.Parameter import Parameter
-from PLC.
Roles import Roles
-from PLC.
Auth import PasswordAuth
+from PLC.
Auth import Auth
+from PLC.
Methods.GetRoles import GetRoles
-class AdmGetAllRoles(
Method
):
+class AdmGetAllRoles(
GetRoles
):
"""
"""
+ Deprecated. See GetRoles.
+
Return all possible roles as a struct:
{'10': 'admin', '20': 'pi', '30': 'user', '40': 'tech'}
Return all possible roles as a struct:
{'10': 'admin', '20': 'pi', '30': 'user', '40': 'tech'}
@@
-15,18
+17,16
@@
class AdmGetAllRoles(Method):
identifiers.
"""
identifiers.
"""
- roles = ['admin', 'pi', 'user', 'tech']
- accepts = [PasswordAuth()]
+ status = "deprecated"
+
returns = dict
def call(self, auth):
returns = dict
def call(self, auth):
- roles = Roles(self.api)
-
- # Just the role_id: name mappings
- roles = dict(filter(lambda (role_id, name): isinstance(role_id, (int, long)), \
- roles.items()))
+ roles_list = GetRoles.call(self, auth)
- # Stringify the keys!
- keys = map(str, roles.keys())
+ roles_dict = {}
+ for role in roles_list:
+ # Stringify the keys!
+ roles_dict[str(role['role_id'])] = role['name']
- return
dict(zip(keys, roles.values()))
+ return
roles_dict