diff --git a/docs/initial_data.yaml b/docs/initial_data.yaml index 665a7744a..32d05f26f 100644 --- a/docs/initial_data.yaml +++ b/docs/initial_data.yaml @@ -14,7 +14,7 @@ name: group_admin password: pbkdf2_sha256$20000$ttObUWd15q10$NJoyZf2OZz9oiw2g4j2TkTh9zGgyVDRFdUkhn8X0nB0= email: group_admin@jumpserver.org - role: DA + role: GA is_active: 1 - model: juser.usergroup pk: 1 diff --git a/jumpserver/api.py b/jumpserver/api.py index 180e145ed..06b8f5460 100644 --- a/jumpserver/api.py +++ b/jumpserver/api.py @@ -499,9 +499,8 @@ def is_role_request(request, role='user'): require this request of user is right 要求请求角色正确 """ - role_all = {'user': 0, 'admin': 1, 'super': 2} - # TODO: liuzheng's work - if request.session.get('role_id') == role_all.get(role, 0): + role_all = {'user': 'CU', 'admin': 'GA', 'super': 'SU'} + if request.user.role == role_all.get(role, 'CU'): return True else: return False diff --git a/juser/views.py b/juser/views.py index f68c852e4..4a9f69d1a 100644 --- a/juser/views.py +++ b/juser/views.py @@ -14,7 +14,8 @@ from juser.user_api import * def chg_role(request): - role = {'SU': 2, 'DA': 1, 'CU': 0} + # TODO: disable it! by liuzheng + role = {'SU': 2, 'GA': 1, 'CU': 0} user, dept = get_session_user_dept(request) # TODO: liuzheng's work if request.session['role_id'] > 0: