Add hook into CSP when deleting an environment role
This commit is contained in:
parent
0798ce4019
commit
c89e5b824c
@ -18,6 +18,13 @@ class CloudProviderInterface:
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
def delete_role(self, environment_role): # pragma: no cover
|
||||||
|
"""Takes an `atst.model.EnvironmentRole` object and performs any action
|
||||||
|
necessary in the CSP to remove the specified user from the specified
|
||||||
|
environment. This method does not return anything.
|
||||||
|
"""
|
||||||
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
|
||||||
class MockCloudProvider(CloudProviderInterface):
|
class MockCloudProvider(CloudProviderInterface):
|
||||||
def create_application(self, name):
|
def create_application(self, name):
|
||||||
@ -28,3 +35,7 @@ class MockCloudProvider(CloudProviderInterface):
|
|||||||
def create_role(self, environment_role):
|
def create_role(self, environment_role):
|
||||||
# Currently, there is nothing to mock out, so just do nothing.
|
# Currently, there is nothing to mock out, so just do nothing.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def delete_role(self, environment_role):
|
||||||
|
# Currently nothing to do.
|
||||||
|
pass
|
||||||
|
@ -27,6 +27,7 @@ class EnvironmentRoles(object):
|
|||||||
def delete(cls, user_id, environment_id):
|
def delete(cls, user_id, environment_id):
|
||||||
existing_env_role = EnvironmentRoles.get(user_id, environment_id)
|
existing_env_role = EnvironmentRoles.get(user_id, environment_id)
|
||||||
if existing_env_role:
|
if existing_env_role:
|
||||||
|
app.csp.cloud.delete_role(existing_env_role)
|
||||||
db.session.delete(existing_env_role)
|
db.session.delete(existing_env_role)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return True
|
return True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user