Skip to content

Commit

Permalink
fix: platform viewer/owner permission for groups
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Jul 31, 2024
1 parent d8f2451 commit e2b16f8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions services/api/src/resources/group/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const getAllGroups: ResolverFn = async (
{ hasPermission, models, keycloakGrant, keycloakUsersGroups, adminScopes }
) => {
// use the admin scope check instead of `hasPermission` for speed
if (adminScopes.platformOwner && adminScopes.platformViewer) {
if (adminScopes.platformOwner || adminScopes.platformViewer) {
try {

if (name) {
Expand Down Expand Up @@ -99,7 +99,7 @@ export const getGroupRolesByUserId: ResolverFn =async (
{ hasPermission, models, keycloakGrant, keycloakUsersGroups, adminScopes }
) => {
// use the admin scope check instead of `hasPermission` for speed
if (adminScopes.platformOwner && adminScopes.platformViewer) {
if (adminScopes.platformOwner || adminScopes.platformViewer) {
try {
const queryUserGroups = await models.UserModel.getAllGroupsForUser(uid);
let groups = []
Expand Down Expand Up @@ -192,7 +192,7 @@ export const getGroupsByProjectId: ResolverFn = async (
{ hasPermission, sqlClientPool, models, keycloakGrant, keycloakUsersGroups, adminScopes }
) => {
// use the admin scope check instead of `hasPermission` for speed
if (adminScopes.platformOwner && adminScopes.platformViewer) {
if (adminScopes.platformOwner || adminScopes.platformViewer) {
try {
const projectGroups = await Helpers(sqlClientPool).selectGroupsByProjectId(models, pid)
return projectGroups;
Expand Down Expand Up @@ -260,7 +260,7 @@ export const getGroupsByUserId: ResolverFn = async (
{ hasPermission, models, keycloakGrant, keycloakUsersGroups, adminScopes }
) => {
// use the admin scope check instead of `hasPermission` for speed
if (adminScopes.platformOwner && adminScopes.platformViewer) {
if (adminScopes.platformOwner || adminScopes.platformViewer) {
try {
const queryUserGroups = await models.UserModel.getAllGroupsForUser(uid);

Expand All @@ -283,7 +283,7 @@ export const getGroupByName: ResolverFn = async (
{ models, hasPermission, keycloakGrant, keycloakUsersGroups, adminScopes }
) => {
// use the admin scope check instead of `hasPermission` for speed
if (adminScopes.platformOwner && adminScopes.platformViewer) {
if (adminScopes.platformOwner || adminScopes.platformViewer) {
try {
const group = await models.GroupModel.loadGroupByName(name);
return group;
Expand Down Expand Up @@ -748,7 +748,7 @@ export const getAllProjectsInGroup: ResolverFn = async (
} = models;

// use the admin scope check instead of `hasPermission` for speed
if (adminScopes.platformOwner && adminScopes.platformViewer) {
if (adminScopes.platformOwner || adminScopes.platformViewer) {
try {
// get group from all keycloak groups apollo context
const group = await loadGroupByIdOrName(groupInput);
Expand Down

0 comments on commit e2b16f8

Please sign in to comment.