mirror of https://github.com/openspug/spug
U ldap账户不再允许被删除,可使用禁用功能代替 #42
parent
ce9adb1129
commit
4c05d5eeaf
|
@ -0,0 +1,17 @@
|
||||||
|
# Copyright: (c) OpenSpug Organization. https://github.com/openspug/spug
|
||||||
|
# Copyright: (c) <spug.dev@gmail.com>
|
||||||
|
# Released under the MIT License.
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
from django.core.management import execute_from_command_line
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
help = '升级Spug版本'
|
||||||
|
|
||||||
|
def add_arguments(self, parser):
|
||||||
|
parser.add_argument('version', help='要升级的版本')
|
||||||
|
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
|
||||||
|
self.stdout.write(self.style.SUCCESS('升级成功'))
|
|
@ -56,10 +56,13 @@ class UserView(View):
|
||||||
Argument('id', type=int, help='请指定操作对象')
|
Argument('id', type=int, help='请指定操作对象')
|
||||||
).parse(request.GET)
|
).parse(request.GET)
|
||||||
if error is None:
|
if error is None:
|
||||||
User.objects.filter(pk=form.id).update(
|
user = User.objects.filter(pk=form.id).first()
|
||||||
deleted_at=human_datetime(),
|
if user:
|
||||||
deleted_by=request.user
|
if user.type == 'ldap':
|
||||||
)
|
return json_response(error='ldap账户无法删除,请使用禁用功能来禁止该账户访问系统')
|
||||||
|
user.deleted_at = human_datetime()
|
||||||
|
user.deleted_by = request.user
|
||||||
|
user.save()
|
||||||
return json_response(error=error)
|
return json_response(error=error)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue