Skip to content
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

fix: platform admin #121

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/operator/gitea.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('giteaOperator', () => {
it('should create a valid group mapping string with all the teams', () => {
const mappingString = buildTeamString(teamNames)
expect(mappingString).to.be.equal(
'{"team-demo":{"otomi":["otomi-viewer","team-demo"]},"team-demo2":{"otomi":["otomi-viewer","team-demo2"]},"team-demo3":{"otomi":["otomi-viewer","team-demo3"]}}',
'{"platform-admin":{"otomi":["Owners"]},"team-demo":{"otomi":["otomi-viewer","team-demo"]},"team-demo2":{"otomi":["otomi-viewer","team-demo2"]},"team-demo3":{"otomi":["otomi-viewer","team-demo3"]}}',
)
expect(mappingString).to.not.contain('team-admin')
})
Expand Down
8 changes: 4 additions & 4 deletions src/operator/gitea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
GITEA_URL_PORT,
cleanEnv,
} from '../validators'
import { orgName, otomiChartsRepoName, otomiValuesRepoName, teamNameViewer, username } from './common'
import { orgName, otomiChartsRepoName, otomiValuesRepoName, teamNameOwners, teamNameViewer, username } from './common'

// Interfaces
interface hookInfo {
Expand Down Expand Up @@ -442,10 +442,10 @@ async function setupGitea() {

// Set Gitea Functions
export function buildTeamString(teamNames: any[]): string {
if (teamNames === undefined) return '{}'
const teamObject: groupMapping = {}
const teamObject: groupMapping = { 'platform-admin': { otomi: [teamNameOwners] } }
if (teamNames === undefined) return JSON.stringify(teamObject)
teamNames.forEach((teamName: string) => {
teamObject[`team-${teamName}`] = { otomi: ['otomi-viewer', `team-${teamName}`] }
teamObject[`team-${teamName}`] = { otomi: [teamNameViewer, `team-${teamName}`] }
})
return JSON.stringify(teamObject)
}
Expand Down
5 changes: 0 additions & 5 deletions src/tasks/common.ts

This file was deleted.