Handle setting no access for user environment roles:
- use constant for no access string - update no access constant - update language and permissions for rendering remove app member button
This commit is contained in:
@@ -2,18 +2,18 @@ from flask_wtf import FlaskForm
|
||||
from wtforms.fields import FieldList, FormField, HiddenField, RadioField, StringField
|
||||
|
||||
from .forms import BaseForm
|
||||
from .data import ENV_ROLES
|
||||
from .data import ENV_ROLES, ENV_ROLE_NO_ACCESS as NO_ACCESS
|
||||
|
||||
|
||||
class MemberForm(FlaskForm):
|
||||
user_id = HiddenField()
|
||||
user_name = StringField()
|
||||
role_name = RadioField(choices=ENV_ROLES, default="no_access")
|
||||
role_name = RadioField(choices=ENV_ROLES, default=NO_ACCESS)
|
||||
|
||||
@property
|
||||
def data(self):
|
||||
_data = super().data
|
||||
if "role_name" in _data and _data["role_name"] == "no_access":
|
||||
if "role_name" in _data and _data["role_name"] == NO_ACCESS:
|
||||
_data["role_name"] = None
|
||||
return _data
|
||||
|
||||
|
@@ -217,6 +217,7 @@ REQUIRED_DISTRIBUTIONS = [
|
||||
("other", "Other as necessary"),
|
||||
]
|
||||
|
||||
ENV_ROLE_NO_ACCESS = "No Access"
|
||||
ENV_ROLES = [(role.value, role.value) for role in CSPRole] + [
|
||||
("no_access", "No access")
|
||||
(ENV_ROLE_NO_ACCESS, "No access")
|
||||
]
|
||||
|
@@ -3,7 +3,7 @@ from wtforms.fields import FormField, FieldList, HiddenField, RadioField, String
|
||||
from wtforms.validators import Required
|
||||
|
||||
from .application_member import EnvironmentForm as BaseEnvironmentForm
|
||||
from .data import ENV_ROLES
|
||||
from .data import ENV_ROLES, ENV_ROLE_NO_ACCESS as NO_ACCESS
|
||||
from .forms import BaseForm
|
||||
from atst.forms.fields import SelectField
|
||||
from atst.domain.permission_sets import PermissionSets
|
||||
@@ -18,6 +18,13 @@ class EnvironmentForm(BaseEnvironmentForm):
|
||||
filters=[lambda x: None if x == "None" else x],
|
||||
)
|
||||
|
||||
@property
|
||||
def data(self):
|
||||
_data = super().data
|
||||
if "role" in _data and _data["role"] == NO_ACCESS:
|
||||
_data["role"] = None
|
||||
return _data
|
||||
|
||||
|
||||
class PermissionsForm(FlaskForm):
|
||||
perms_team_mgmt = SelectField(
|
||||
|
Reference in New Issue
Block a user