forked from shaba/openuds
Fixed calendar action "Remove all user services"
This commit is contained in:
parent
a0ba19010c
commit
2627f96499
@ -165,7 +165,7 @@ class Config:
|
||||
obj.value, obj.crypt, obj.long, obj.field_type = value, self._crypt, self._longText, self._type
|
||||
obj.save()
|
||||
except Exception:
|
||||
if 'migrate' in sys.argv:
|
||||
if 'migrate' in sys.argv: # During migration, set could be saved as part of initialization...
|
||||
return
|
||||
logger.exception('Exception')
|
||||
# Probably a migration issue, just ignore it
|
||||
|
@ -40,7 +40,9 @@ import typing
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.db import models
|
||||
|
||||
from uds.core.util import (calendar, log)
|
||||
from uds.core.util import calendar
|
||||
from uds.core.util import log
|
||||
from uds.core.util import state
|
||||
|
||||
from .calendar import Calendar
|
||||
from .uuid_model import UUIDModel
|
||||
@ -174,7 +176,9 @@ class CalendarAction(UUIDModel):
|
||||
elif CALENDAR_ACTION_IGNORE_UNUSED['id'] == self.action:
|
||||
self.service_pool.ignores_unused = params['state'] in ('true', '1', True)
|
||||
elif CALENDAR_ACTION_REMOVE_USERSERVICES['id'] == self.action:
|
||||
self.service_pool.assignedUserServices().delete()
|
||||
# 1.- Remove usable assigned services (Ignore "creating ones", just for created)
|
||||
for userService in self.service_pool.assignedUserServices().filter(state=state.State.USABLE):
|
||||
userService.remove()
|
||||
else:
|
||||
caTransports = (CALENDAR_ACTION_ADD_TRANSPORT['id'], CALENDAR_ACTION_DEL_TRANSPORT['id'])
|
||||
caGroups = (CALENDAR_ACTION_ADD_GROUP['id'], CALENDAR_ACTION_DEL_GROUP['id'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user