Skip to content

Allow PMs to edit permitted project fields#795

Merged
drubgrubby merged 8 commits intohackforla:developmentfrom
chukalicious:feature/allow-pm-to-edit-project-fields
Dec 16, 2021
Merged

Allow PMs to edit permitted project fields#795
drubgrubby merged 8 commits intohackforla:developmentfrom
chukalicious:feature/allow-pm-to-edit-project-fields

Conversation

@chukalicious
Copy link
Member

@chukalicious chukalicious commented Dec 12, 2021

Closes #701

Description:

This PR restricts the updating of specific fields in the project object, granting full access to editable fields to users with 'admin' access level, and restricted access to users with 'user' access level.

Action taken:

  • Created a canEdit prop for the field components that's an array of types of users allowed to make changes to the field
  • Compared the logged in user's access level to the values in the canEdit prop
  • If the access level can be found in the array the edit button will be enabled, if not, a link that navigates to a readme doc with instructions will be rendered

…eated state for access user info and sent as props to EditProject component
… type of user can edit the field. In the editableFiled.js set up a restricted state and function that checks whether the users access level is is included in the canEdit array and thru conditional rendering the edit button is enabled/disabled
Copy link
Member

@drubgrubby drubgrubby left a comment

Choose a reason for hiding this comment

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

@chukalicious => This is exactly the required functionality and very nicely done.

Additionally, you write very tidy code which is easy to read. Much appreciated.

I'm going to wait to merge this as I think Bonnie may want to change the message to something specific that tells them who to contact if they need to make a change to one of the fields that they don't have access to. We'll ask her tomorrow night.

Really nice work!

Comment on lines -7 to +9
const EditProjectInfo = ( props ) => {

const EditProject = (props) => {
Copy link
Member

Choose a reason for hiding this comment

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

Were you an English major? I love that the name of this component bothered you enough to change it here, and in all of the other places that it appears. Miriam Webster would be proud of you.

Copy link
Member Author

Choose a reason for hiding this comment

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

😆 I can barely put two words of English together! But yeah, I find it confusing when the component and the file don't have the same name.

@drubgrubby
Copy link
Member

Per Bonnie, we should create a readme/markdown file in vrms and link to it from the error message. The message on the project edit page should read something like: "You don't have access to edit this field. Click here to find out who does". Or something better with fewer words.

@chukalicious
Copy link
Member Author

chukalicious commented Dec 14, 2021

@drubgrubby Hi, I have created the readme file and linked it to the disabled edit button but maybe the link will need to be updated when the branch gets merged, unless you know of another way in which I can link the file without requesting a second merge. I hope that makes sense 😬

Copy link
Member

@drubgrubby drubgrubby left a comment

Choose a reason for hiding this comment

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

In discussion with @chukalicious we have decide to merge this as is - which is working perfectly, but needing some changes to the links - and create a new issue to make those changes.

That issue is #796

@drubgrubby drubgrubby merged commit 5cce680 into hackforla:development Dec 16, 2021
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.

Project Detail Edit: Hide info that needs approval from PM view

2 participants