Merge pull request #4729 from concourse/fine-grain-cf-auth

update cf auth flags for space with role
This commit is contained in:
Joshua Winters 2019-11-11 10:30:37 -05:00 committed by GitHub
commit 5f02d6770f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -2,16 +2,16 @@ roles:
- name: member
cf:
users: ["some-member"]
space_developers: ["some-org:some-space"]
spaces_with_developer_role: ["some-org:some-space"]
- name: owner
cf:
users: ["some-admin"]
orgs: ["some-org"]
spaceguids: ["some-guid"]
space_managers: ["some-org:some-space"]
spaces_with_manager_role: ["some-org:some-space"]
- name: viewer
cf:
spaces: ["some-org:some-space"]
spaces_all: ["some-org:some-other-space"]
spaces_with_any_role: ["some-org:some-other-space"]
space_guids: ["some-guid"]
space_auditors: ["some-org:some-space"]
spaces_with_auditor_role: ["some-org:some-space"]

View File

@ -72,10 +72,10 @@ type CFTeamFlags struct {
Users []string `long:"user" description:"A whitelisted CloudFoundry user" value-name:"USERNAME"`
Orgs []string `long:"org" description:"A whitelisted CloudFoundry org" value-name:"ORG_NAME"`
Spaces []string `long:"space" description:"(Deprecated) A whitelisted CloudFoundry space for users with the 'developer' role" value-name:"ORG_NAME:SPACE_NAME"`
SpacesAll []string `long:"space-all" description:"A whitelisted CloudFoundry space for users with any role" value-name:"ORG_NAME:SPACE_NAME" mapstructure:"spaces_all"`
SpaceDevelopers []string `long:"space-developer" description:"A whitelisted CloudFoundry space for users with the 'developer' role" value-name:"ORG_NAME:SPACE_NAME" mapstructure:"space_developers"`
SpaceAuditors []string `long:"space-auditor" description:"A whitelisted CloudFoundry space for users with the 'auditor' role" value-name:"ORG_NAME:SPACE_NAME" mapstructure:"space_auditors"`
SpaceManagers []string `long:"space-manager" description:"A whitelisted CloudFoundry space for users with the 'manager' role" value-name:"ORG_NAME:SPACE_NAME" mapstructure:"space_managers"`
SpacesAll []string `long:"space-with-any-role" description:"A whitelisted CloudFoundry space for users with any role" value-name:"ORG_NAME:SPACE_NAME" mapstructure:"spaces_with_any_role"`
SpacesDeveloper []string `long:"space-with-developer-role" description:"A whitelisted CloudFoundry space for users with the 'developer' role" value-name:"ORG_NAME:SPACE_NAME" mapstructure:"spaces_with_developer_role"`
SpacesAuditor []string `long:"space-with-auditor-role" description:"A whitelisted CloudFoundry space for users with the 'auditor' role" value-name:"ORG_NAME:SPACE_NAME" mapstructure:"spaces_with_auditor_role"`
SpacesManager []string `long:"space-with-manager-role" description:"A whitelisted CloudFoundry space for users with the 'manager' role" value-name:"ORG_NAME:SPACE_NAME" mapstructure:"spaces_with_manager_role"`
SpaceGuids []string `long:"space-guid" description:"(Deprecated) A whitelisted CloudFoundry space guid" value-name:"SPACE_GUID" mapstructure:"space_guids"`
SpaceGuidsLegacy []string `mapstructure:"spaceguids"`
}
@ -91,13 +91,13 @@ func (flag *CFTeamFlags) GetGroups() []string {
for _, space := range flag.Spaces {
groups = append(groups, fmt.Sprintf("%s:developer", space))
}
for _, space := range flag.SpaceDevelopers {
for _, space := range flag.SpacesDeveloper {
groups = append(groups, fmt.Sprintf("%s:developer", space))
}
for _, space := range flag.SpaceAuditors {
for _, space := range flag.SpacesAuditor {
groups = append(groups, fmt.Sprintf("%s:auditor", space))
}
for _, space := range flag.SpaceManagers {
for _, space := range flag.SpacesManager {
groups = append(groups, fmt.Sprintf("%s:manager", space))
}
groups = append(groups, flag.SpaceGuids...)