-
Notifications
You must be signed in to change notification settings - Fork 77
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
OCLOMRS-955 and OCLOMRS-956: Add missing permissions checks for organizations #676
Conversation
…955 and Missing Permissions Check for Edit Organization button:OCLOMRS-956
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -25,6 +25,7 @@ import {ConfirmationDialog} from "../../../utils"; | |||
|
|||
interface Props { | |||
members?: OrgMember[]; | |||
canModifyMembers:boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
canModifyMembers:boolean; | |
canModifyMembers: boolean; |
@@ -59,7 +60,7 @@ const confirmationMsg = () => { | |||
</div> | |||
); | |||
}; | |||
const OrganisationMembers: React.FC<Props> = ({ members, orgUrl, addMember, loading, addError, deleteMember ,deleteError}) => { | |||
const OrganisationMembers: React.FC<Props> = ({ canModifyMembers,members, orgUrl, addMember, loading, addError, deleteMember ,deleteError}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const OrganisationMembers: React.FC<Props> = ({ canModifyMembers,members, orgUrl, addMember, loading, addError, deleteMember ,deleteError}) => { | |
const OrganisationMembers: React.FC<Props> = ({ canModifyMembers, members, orgUrl, addMember, loading, addError, deleteMember ,deleteError}) => { |
@@ -109,9 +115,10 @@ const ViewOrganisationPage: React.FC<Props> = ({ | |||
retrieveOrgCollections(orgUrl); | |||
retrieveOrgMembers(orgUrl); | |||
}, [orgUrl, retrieveOrg, retrieveOrgCollections, retrieveOrgSources,retrieveOrgMembers]); | |||
const isAnOrgMember = (owner: string, id:string) => Boolean(profile?.username === owner || usersOrgs?.map(org => org.id).includes(id)); | |||
const canModify=isAnOrgMember(organisation.created_by, organisation.id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const canModify=isAnOrgMember(organisation.created_by, organisation.id); | |
const canModify = isAnOrgMember(organisation.created_by, organisation.id); |
@@ -1,6 +1,6 @@ | |||
import React, {useEffect} from "react"; | |||
import {connect} from "react-redux"; | |||
import {useLocation} from "react-router-dom"; | |||
import {useLocation, useParams} from "react-router-dom"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this import useParams
@@ -29,8 +29,12 @@ import {Grid, makeStyles, createStyles} from "@material-ui/core"; | |||
import {EditButton} from "../../containers/components/EditButton"; | |||
import {getPrettyError} from "../../../utils"; | |||
import { AppState } from "../../../redux"; | |||
import {APIOrg, APIProfile, canModifyContainer, profileSelector} from "../../authentication"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this import of canModifyContainer
since you are not using it.
Thanks, @hadijahkyampeire for the review, I have updated the PR with improved formatting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, well done @suruchee
Missing Permissions Check for Organization Member Management:OCLOMRS-955 and Missing Permissions Check for "Edit Organization" button:OCLOMRS-956"