diff --git a/frontend/web/components/RolesTable.tsx b/frontend/web/components/RolesTable.tsx
index 9a45a43e7a9c..f95fad01ae06 100644
--- a/frontend/web/components/RolesTable.tsx
+++ b/frontend/web/components/RolesTable.tsx
@@ -32,13 +32,14 @@ const RolesTable: FC = ({ organisationId, users }) => {
level: 'organisation',
permission: 'ADMIN',
})
- const createRole = () => {
+ const createRole = (tagBased: boolean) => {
openModal(
- 'Create Role',
+ tagBased ? 'Create Tag-based role' : 'Create Role',
{
- toast('Role Created')
+ toast(tagBased ? 'Tag-based Role Created' : 'Role Created')
closeModal()
}}
/>,
@@ -60,7 +61,9 @@ const RolesTable: FC = ({ organisationId, users }) => {
const editRole = (role: Role) => {
openModal(
- 'Edit Role and Permissions',
+ role.tag_based
+ ? `Edit Tag-based Role: ${role.name}`
+ : `Edit Role: ${role.name}`,
= ({ organisationId, users }) => {
'side-modal',
)
}
+ const tag_based_permissions = Utils.getFlagsmithHasFeature(
+ 'tag_based_permissions',
+ )
return (
<>
@@ -85,7 +91,7 @@ const RolesTable: FC = ({ organisationId, users }) => {
disabled={!isAdmin}
className='mr-2'
id='btn-invite'
- onClick={() => createRole()}
+ onClick={() => createRole(false)}
type='button'
>
Create Role
@@ -97,9 +103,9 @@ const RolesTable: FC = ({ organisationId, users }) => {
you can assign roles to users and/or groups.
!v.tag_based)}
itemHeight={65}
header={
@@ -163,7 +169,7 @@ const RolesTable: FC = ({ organisationId, users }) => {
)}
renderNoResults={
-
+
You currently have no organisation roles
@@ -173,6 +179,107 @@ const RolesTable: FC = ({ organisationId, users }) => {
}
isLoading={false}
/>
+ {tag_based_permissions && (
+ <>
+
+ Tag-based Roles
+ {Utils.renderWithPermission(
+ isAdmin,
+ Constants.organisationPermissions('Admin'),
+ ,
+ )}
+
+
+ Use tag-based roles to grant permissions for features with specific
+ tags.
+
+ !!v.tag_based)}
+ itemHeight={65}
+ header={
+
+
+ Name
+
+ Description
+
+ Remove
+
+
+ }
+ renderRow={(role: Role) => (
+
+ {
+ editRole(role)
+ }}
+ className='table-column'
+ style={{
+ width: rolesWidths[0],
+ }}
+ >
+ {role.name}
+
+ {
+ editRole(role)
+ }}
+ >
+ {role.description}
+
+
+
+
+
+ )}
+ renderNoResults={
+
+
+
+ You currently have no tag-based roles
+
+
+
+ }
+ isLoading={false}
+ />
+ >
+ )}
>
)
}
diff --git a/frontend/web/components/TagBasedPermissions.tsx b/frontend/web/components/TagBasedPermissions.tsx
index 322de87e67c9..63cf8c778d4e 100644
--- a/frontend/web/components/TagBasedPermissions.tsx
+++ b/frontend/web/components/TagBasedPermissions.tsx
@@ -36,7 +36,7 @@ const TagBasedPermissions: FC = ({
{role?.tag_based && (
- Enable permissions for the following tags:
+ Permissions will only apply for features with the following tags:
void
organisationId?: number
+ tagBased: boolean
role?: number
users?: User[]
}
@@ -68,6 +69,7 @@ const CreateRole: FC = ({
onComplete,
organisationId,
role: role_id,
+ tagBased,
users,
}) => {
const { data: role, isLoading } = useGetRoleQuery(
@@ -89,7 +91,6 @@ const CreateRole: FC = ({
}[]
>([])
- const [tagBased, setTagBased] = useState(!!role?.tag_based)
const [groupSelected, setGroupSelected] = useState<
{
group: number
@@ -312,7 +313,6 @@ const CreateRole: FC = ({
)
useEffect(() => {
if (!isLoading && isEdit && roleData) {
- setTagBased(roleData.tag_based)
setRoleName(roleData.name)
setRoleDesc(roleData.description || '')
}
@@ -370,27 +370,6 @@ const CreateRole: FC = ({
id='roleName'
placeholder='E.g. Viewers'
/>
-
- }
- unsaved={isEdit && roleDescChanged}
- onChange={(event: InputEvent) => {
- setRoleDescChanged(true)
- setRoleDesc(Utils.safeParseEventValue(event))
- }}
- id='description'
- placeholder='E.g. Some role description'
- />