Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: hide publish button based on permissions #4203

Merged
merged 9 commits into from
Nov 20, 2023
Merged

Conversation

DanRibbens
Copy link
Contributor

@DanRibbens DanRibbens commented Nov 17, 2023

Description

Removes the publish button when access control does not allow a user to publish collections and globals.

  • I have read and understand the CONTRIBUTING.md document in this repository.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

  • I have added tests that prove my fix is effective or that my feature works
  • Existing test suite passes locally with my changes

@@ -58,6 +58,8 @@ export const DocumentControls: React.FC<{

const hasCreatePermission = 'create' in permissions && permissions.create?.permission
const hasDeletePermission = 'delete' in permissions && permissions.delete?.permission
const hasPublishPermission =
'publish' in permissions && permissions.fields?._status?.update?.permission
Copy link
Contributor

@JarrodMFlesch JarrodMFlesch Nov 17, 2023

Choose a reason for hiding this comment

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

I know this is a WIP, just wanted to note that publish does not exist on the permissions type as of right now.

export type CollectionPermission = {
create: Permission
delete: Permission
fields: {
[fieldName: string]: FieldPermissions
}
read: Permission
readVersions?: Permission
update: Permission
}
export type GlobalPermission = {
fields: {
[fieldName: string]: FieldPermissions
}
read: Permission
readVersions?: Permission
update: Permission
}

@DanRibbens DanRibbens changed the title feat: WIP hide publish button based on permissions feat: hide publish button based on permissions Nov 20, 2023
@DanRibbens DanRibbens merged commit de02490 into main Nov 20, 2023
29 checks passed
@DanRibbens DanRibbens deleted the feat/publish-access branch November 20, 2023 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants