Skip to content

Commit

Permalink
Merge pull request #3343 from uselagoon/prohibit-project-renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
tobybellwood authored Nov 24, 2022
2 parents e3058aa + 26e45fc commit e6ffbd1
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions services/api/src/resources/project/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,16 @@ export const updateProject: ResolverFn = async (
}
}

// if the name is provided in a patch, check that the user trying to rename the project is an admin.
// renaming projects is prohibited because lagoon uses the project name for quite a few things
// which if changed can have unintended consequences for any existing environments
if (patch.name) {
const canUpdateName = await isAdminCheck(hasPermission);
if (!canUpdateName) {
throw new Error('Project renaming is only available to administrators.');
}
}

if (gitUrl !== undefined && !isValidGitUrl(gitUrl)) {
throw new Error('The provided gitUrl is invalid.');
}
Expand Down

0 comments on commit e6ffbd1

Please sign in to comment.