Skip to content

Conversation

@kyle-ssg
Copy link
Member

@kyle-ssg kyle-ssg commented Dec 16, 2025

Thanks for submitting a PR! Please check the boxes below:

  • I have added information to docs/ if required so people know about the feature!
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

How did you test this code?

E2E, checking each usage of permission

Note: due to amount of refactoring I've done, I've pointed this to the latest branch I've been working on

…on-types

# Conflicts:
#	frontend/common/providers/Permission.tsx
#	frontend/web/components/modals/create-feature/index.js
…on-types

# Conflicts:
#	frontend/web/components/modals/create-feature/index.js
@kyle-ssg kyle-ssg requested a review from a team as a code owner December 16, 2025 15:42
@kyle-ssg kyle-ssg requested review from talissoncosta and removed request for a team December 16, 2025 15:42
@vercel
Copy link

vercel bot commented Dec 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
flagsmith-frontend-preview Ready Ready Preview, Comment Dec 16, 2025 3:42pm
flagsmith-frontend-staging Ready Ready Preview, Comment Dec 16, 2025 3:42pm
1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Ignored Ignored Dec 16, 2025 3:42pm

@github-actions github-actions bot added the front-end Issue related to the React Front End Dashboard label Dec 16, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 16, 2025

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-6417 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api-test:pr-6417 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-6417 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-6417 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-6417 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-6417 Finished ✅ Results

@kyle-ssg kyle-ssg changed the title Chore/permission types chore: permission types Dec 16, 2025
@kyle-ssg kyle-ssg requested a review from Zaimwa9 December 16, 2025 15:52
@github-actions github-actions bot added the chore label Dec 16, 2025
@Zaimwa9 Zaimwa9 removed their request for review December 31, 2025 14:36
Copy link
Contributor

@Zaimwa9 Zaimwa9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks neat. There are just 2 conditions that got truncated somehow and a couple of NITs

Comment on lines +283 to +284
permissions[EnvironmentPermission.VIEW_IDENTITIES]
permissions.ADMIN
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
permissions[EnvironmentPermission.VIEW_IDENTITIES]
permissions.ADMIN
permissions[EnvironmentPermission.VIEW_IDENTITIES] ||
permissions.ADMIN

Comment on lines +1895 to +1898
(!savePermission,
isSaving ||
!projectFlag.name ||
invalid)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(!savePermission,
isSaving ||
!projectFlag.name ||
invalid)
(!savePermission ||
isSaving ||
!projectFlag.name ||
invalid)

},
organisationPermissions: (perm: string) =>
organisationPermissions: (perm: OrganisationPermissionDescription) =>
`To manage this feature you need the <i>${perm}</i> permission for this organisastion.<br/>Please contact a member of this organisation who has administrator privileges.`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`To manage this feature you need the <i>${perm}</i> permission for this organisastion.<br/>Please contact a member of this organisation who has administrator privileges.`,
`To manage this feature you need the <i>${perm}</i> permission for this organisation.<br/>Please contact a member of this organisation who has administrator privileges.`,


const finalPermission = hasPermission || AccountStore.isAdmin()

let permissionDescriptionFunc: (perm: any) => any =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about renaming to something like getPermissionDescription?

Comment on lines +200 to +203
permissionName ||
permissionDescriptionFunc(
PermissionDescriptions[permission as ProjectPermission],
),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we put this into a variable and re-use it in the 2 places?

'#F57C78',
],
projectPermissions: (perm: string) =>
projectPermissions: (perm: ProjectPermissionDescription) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, can't we use directly the enum here and get the description within this function ?
const description = ProjectPermissionDescriptions[perm];

Comment on lines 27 to +29
type PermissionType = {
id: number | string
permission: string
permission: PermissionEnum
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT:
Here we could use a union type like:

type OrganisationLevelProps = BasePermissionProps & {
  level: 'organisation';
  permission: OrganisationPermission;
};

same with env and project and then
export type PermissionType = 
  | ProjectLevelProps 
  | EnvironmentLevelProps 
  | OrganisationLevelProps;

so the permission would directly be inferred and we can get invalid combinations directly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permission check for editing an identities feature needs "UPDATE_FEATURE_STATE" permission

3 participants