Fix observers not being allowed access to policies (#11071)

This commit is contained in:
Luke Heath 2023-04-07 18:17:09 -05:00 committed by GitHub
parent 670492c129
commit 0deed1f112
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 17 additions and 3 deletions

View File

@ -16,7 +16,12 @@ export default PropTypes.shape({
teams: PropTypes.arrayOf(teamInterface),
});
export const USERS_ROLES = ["admin", "maintainer", "observer"] as const;
export const USERS_ROLES = [
"admin",
"maintainer",
"observer",
"observer_plus",
] as const;
export type IUserRole = typeof USERS_ROLES[number];
export type UserRole =
| "admin"

View File

@ -49,6 +49,7 @@ const AgentOptionsPage = ({
admin: true,
maintainer: false,
observer: false,
observer_plus: false,
},
});

View File

@ -64,6 +64,7 @@ const MembersPage = ({ location, router }: IMembersPageProps): JSX.Element => {
admin: true,
maintainer: false,
observer: false,
observer_plus: false,
},
});

View File

@ -117,6 +117,7 @@ const TeamDetailsWrapper = ({
admin: true,
maintainer: false,
observer: false,
observer_plus: false,
},
});

View File

@ -53,6 +53,7 @@ const ManagePolicyPage = ({
location,
}: IManagePoliciesPageProps): JSX.Element => {
const {
currentUser,
isGlobalAdmin,
isGlobalMaintainer,
isOnGlobalTeam,
@ -62,6 +63,8 @@ const ManagePolicyPage = ({
} = useContext(AppContext);
const { renderFlash } = useContext(NotificationContext);
console.log("currentUser: ", currentUser);
const {
setLastEditedQueryName,
setLastEditedQueryDescription,
@ -89,7 +92,8 @@ const ManagePolicyPage = ({
permittedAccessByTeamRole: {
admin: true,
maintainer: true,
observer: false,
observer: true,
observer_plus: true,
},
});

View File

@ -77,7 +77,8 @@ const PolicyPage = ({
permittedAccessByTeamRole: {
admin: true,
maintainer: true,
observer: false,
observer: true,
observer_plus: true,
},
});

View File

@ -141,6 +141,7 @@ const ManageSchedulePage = ({
admin: true,
maintainer: true,
observer: false,
observer_plus: false,
},
});