Add in check for removing the PPoC
This commit is contained in:
parent
f003baad7c
commit
360dab0a32
@ -177,6 +177,12 @@ def remove_member(portfolio_id, user_id):
|
||||
g.current_user, "you cant remove yourself from the portfolio"
|
||||
)
|
||||
|
||||
portfolio = Portfolios.get(user=g.current_user, portfolio_id=portfolio_id)
|
||||
if user_id == str(portfolio.owner.id):
|
||||
raise UnauthorizedError(
|
||||
g.current_user, "you can't delete the portfolios PPoC from the portfolio"
|
||||
)
|
||||
|
||||
portfolio_role = PortfolioRoles.get(portfolio_id=portfolio_id, user_id=user_id)
|
||||
# TODO: should this cascade and disable any application and environment
|
||||
# roles they might have?
|
||||
|
@ -358,6 +358,7 @@ def test_remove_portfolio_member_self(client, user_session):
|
||||
== PortfolioRoleStatus.ACTIVE
|
||||
)
|
||||
|
||||
|
||||
def test_remove_portfolio_member_ppoc(client, user_session):
|
||||
portfolio = PortfolioFactory.create()
|
||||
|
||||
@ -384,5 +385,3 @@ def test_remove_portfolio_member_ppoc(client, user_session):
|
||||
PortfolioRoles.get(portfolio_id=portfolio.id, user_id=portfolio.owner.id).status
|
||||
== PortfolioRoleStatus.ACTIVE
|
||||
)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user