Skip to content

Commit

Permalink
Merge pull request #1103 from alesstimec/applicationoffer-user-lowerc…
Browse files Browse the repository at this point in the history
…ase-fix-01

ApplicatonOffer consume fix.
  • Loading branch information
alesstimec authored Nov 22, 2023
2 parents 00e3840 + 241833b commit 7498ae4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion internal/dbmodel/applicationoffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ func (o *ApplicationOffer) SetTag(t names.ApplicationOfferTag) {
// UserAccess returns the access level for the specified user.
func (o *ApplicationOffer) UserAccess(u *User) string {
for _, ou := range o.Users {
if u.Username == ou.Username {
// NOTE (alesstimec) remove this once juju decides that
// users are allowed to have upper case characters in
// usernames (see https://bugs.launchpad.net/juju/+bug/1959584)
if strings.ToLower(u.Username) == strings.ToLower(ou.Username) {
return ou.Access
}
}
Expand Down
1 change: 0 additions & 1 deletion internal/jimm/applicationoffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ func (j *JIMM) GetApplicationOfferConsumeDetails(ctx context.Context, user *dbmo
if accessLevel == "" {
accessLevel = offer.UserAccess(&dbmodel.User{Username: auth.Everyone})
}

switch accessLevel {
case string(jujuparams.OfferAdminAccess):
case string(jujuparams.OfferConsumeAccess):
Expand Down

0 comments on commit 7498ae4

Please sign in to comment.