mirror of https://github.com/jumpserver/jumpserver
修改组添加
parent
c6e0429584
commit
65b29cb68d
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
|
|
||||||
from juser.models import Group, User
|
from juser.models import UserGroup, User
|
||||||
|
|
||||||
|
|
||||||
class AddError(Exception):
|
class AddError(Exception):
|
||||||
|
@ -21,12 +21,12 @@ def group_add(request):
|
||||||
error = u'缁勫悕涓嶈兘涓虹┖'
|
error = u'缁勫悕涓嶈兘涓虹┖'
|
||||||
raise AddError
|
raise AddError
|
||||||
|
|
||||||
group = Group.objects.filter(name=group_name)
|
group = UserGroup.objects.filter(name=group_name)
|
||||||
if group:
|
if group:
|
||||||
error = u'缁 %s 宸插瓨鍦' % group_name
|
error = u'缁 %s 宸插瓨鍦' % group_name
|
||||||
raise AddError
|
raise AddError
|
||||||
|
|
||||||
group = Group(name=group_name, comment=comment)
|
group = UserGroup(name=group_name, comment=comment)
|
||||||
group.save()
|
group.save()
|
||||||
except AddError:
|
except AddError:
|
||||||
pass
|
pass
|
||||||
|
@ -44,7 +44,7 @@ def group_add(request):
|
||||||
|
|
||||||
|
|
||||||
def group_list(request):
|
def group_list(request):
|
||||||
groups = Group.objects.all()
|
groups = UserGroup.objects.all()
|
||||||
return render_to_response('juser/group_list.html',
|
return render_to_response('juser/group_list.html',
|
||||||
{'header_title': u'鏌ョ湅灞炵粍 | Add Group',
|
{'header_title': u'鏌ョ湅灞炵粍 | Add Group',
|
||||||
'path1': 'juser', 'path2': 'group_add',
|
'path1': 'juser', 'path2': 'group_add',
|
||||||
|
@ -60,7 +60,7 @@ def user_add(request):
|
||||||
msg = ''
|
msg = ''
|
||||||
|
|
||||||
user_role = {'SU': 'SuperUser', 'GA': 'GroupAdmin', 'CU': 'CommonUser'}
|
user_role = {'SU': 'SuperUser', 'GA': 'GroupAdmin', 'CU': 'CommonUser'}
|
||||||
groups = Group.objects.all()
|
groups = UserGroup.objects.all()
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
username = request.POST.get('j_username', None)
|
username = request.POST.get('j_username', None)
|
||||||
password = request.POST.get('j_password', None)
|
password = request.POST.get('j_password', None)
|
||||||
|
|
Loading鈥
Reference in New Issue