activate/deactivate nextcloud users

This commit is contained in:
Jorge Pastor 2024-01-03 19:49:42 +01:00
parent 8eae8e624f
commit b06f0d1cd6
1 changed files with 11 additions and 2 deletions

View File

@ -92,6 +92,11 @@ class NextCloudAPIMixin(object):
} }
self.api_put('users/%s' % saas.name, data) self.api_put('users/%s' % saas.name, data)
def disable_user(self, saas):
self.api_put('users/%s/disable' % saas.name)
def enable_user(self, saas):
self.api_put('users/%s/enable' % saas.name)
def get_user(self, saas): def get_user(self, saas):
""" """
@ -152,8 +157,12 @@ class NextCloudController(NextCloudAPIMixin, ServiceController):
self.api_delete('users/%s' % saas.name) self.api_delete('users/%s' % saas.name)
def save(self, saas): def save(self, saas):
# TODO disable user https://github.com/owncloud/core/issues/12601
self.append(self.update_or_create, saas) self.append(self.update_or_create, saas)
if saas.is_active:
self.enable_user(saas)
else:
self.disable_user(saas)
def delete(self, saas): def delete(self, saas):
self.append(self.remove, saas) self.append(self.remove, saas)