Commit 09020f2f authored by Giorgos Korfiatis's avatar Giorgos Korfiatis

astakos: Disallow base project termination

Base projects accompany users and should not be arbitrarily terminated.
parent 531f88a0
...@@ -1110,6 +1110,9 @@ def terminate(project_id, request_user=None, reason=None): ...@@ -1110,6 +1110,9 @@ def terminate(project_id, request_user=None, reason=None):
project = get_project_for_update(project_id) project = get_project_for_update(project_id)
project_check_allowed(project, request_user, level=ADMIN_LEVEL) project_check_allowed(project, request_user, level=ADMIN_LEVEL)
checkAlive(project) checkAlive(project)
if project.is_base:
m = _(astakos_messages.BASE_NO_TERMINATE) % project.uuid
raise ProjectConflict(m)
project.terminate(actor=request_user, reason=reason) project.terminate(actor=request_user, reason=reason)
quotas.qh_sync_project(project) quotas.qh_sync_project(project)
......
...@@ -228,6 +228,7 @@ UNIQUE_PROJECT_NAME_CONSTRAIN_ERR = ( ...@@ -228,6 +228,7 @@ UNIQUE_PROJECT_NAME_CONSTRAIN_ERR = (
NOT_ALIVE_PROJECT = 'Project %s is not alive.' NOT_ALIVE_PROJECT = 'Project %s is not alive.'
NOT_SUSPENDED_PROJECT = 'Project %s is not suspended.' NOT_SUSPENDED_PROJECT = 'Project %s is not suspended.'
NOT_TERMINATED_PROJECT = 'Project %s is not terminated.' NOT_TERMINATED_PROJECT = 'Project %s is not terminated.'
BASE_NO_TERMINATE = "Cannot terminate: %s is a base project."
NOT_ALLOWED = 'You do not have the permissions to perform this action.' NOT_ALLOWED = 'You do not have the permissions to perform this action.'
MEMBER_NUMBER_LIMIT_REACHED = ( MEMBER_NUMBER_LIMIT_REACHED = (
'You have reached the maximum number of members for this Project.') 'You have reached the maximum number of members for this Project.')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment