mainusers only in newservers
This commit is contained in:
parent
889714778d
commit
24956867f0
|
@ -541,19 +541,19 @@ class UNIXUserControllerNewServers(ServiceController):
|
||||||
for member in settings.SYSTEMUSERS_DEFAULT_GROUP_MEMBERS:
|
for member in settings.SYSTEMUSERS_DEFAULT_GROUP_MEMBERS:
|
||||||
context['member'] = member
|
context['member'] = member
|
||||||
self.append('usermod -a -G %(user)s %(member)s || exit_code=$?' % context)
|
self.append('usermod -a -G %(user)s %(member)s || exit_code=$?' % context)
|
||||||
if not user.is_main:
|
|
||||||
self.append('usermod -a -G %(user)s %(mainuser)s || exit_code=$?' % context)
|
|
||||||
|
|
||||||
def delete(self, user):
|
def delete(self, user):
|
||||||
context = self.get_context(user)
|
context = self.get_context(user)
|
||||||
if not context['user']:
|
if not context['user']:
|
||||||
return
|
return
|
||||||
self.append(textwrap.dedent("""
|
if user.is_main:
|
||||||
|
self.append(textwrap.dedent("""\
|
||||||
# Delete %(user)s user
|
# Delete %(user)s user
|
||||||
nohup bash -c 'sleep 2 && killall -u %(user)s -s KILL' &> /dev/null &
|
nohup bash -c 'sleep 2 && killall -u %(user)s -s KILL' &> /dev/null &
|
||||||
killall -u %(user)s || true
|
killall -u %(user)s || true
|
||||||
userdel %(user)s || exit_code=$?
|
userdel %(user)s || exit_code=$?
|
||||||
groupdel %(group)s || exit_code=$?\
|
groupdel %(group)s || exit_code=$?
|
||||||
""") % context
|
""") % context
|
||||||
)
|
)
|
||||||
if context['deleted_home']:
|
if context['deleted_home']:
|
||||||
|
@ -569,6 +569,7 @@ class UNIXUserControllerNewServers(ServiceController):
|
||||||
else:
|
else:
|
||||||
self.append("rm -fr -- '%(base_home)s'" % context)
|
self.append("rm -fr -- '%(base_home)s'" % context)
|
||||||
|
|
||||||
|
# TODO: comprovar funciones que no se suelen utilizar
|
||||||
def grant_permissions(self, user, context):
|
def grant_permissions(self, user, context):
|
||||||
context['perms'] = user.set_perm_perms
|
context['perms'] = user.set_perm_perms
|
||||||
# Capital X adds execution permissions for directories, not files
|
# Capital X adds execution permissions for directories, not files
|
||||||
|
@ -680,12 +681,12 @@ class UNIXUserControllerNewServers(ServiceController):
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_groups(self, user):
|
def get_groups(self, user):
|
||||||
|
groups = []
|
||||||
if user.is_main:
|
if user.is_main:
|
||||||
groups = list(user.account.systemusers.exclude(username=user.username).values_list('username', flat=True))
|
groups = list(user.account.systemusers.exclude(username=user.username).values_list('username', flat=True))
|
||||||
groups.append("main-systemusers")
|
groups.append("main-systemusers")
|
||||||
return groups
|
# groups = list(user.groups.values_list('username', flat=True))
|
||||||
groups = list(user.groups.values_list('username', flat=True))
|
# groups.append("webapp-systemusers")
|
||||||
groups.append("webapp-systemusers")
|
|
||||||
return groups
|
return groups
|
||||||
|
|
||||||
def get_context(self, user):
|
def get_context(self, user):
|
||||||
|
|
Loading…
Reference in New Issue