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

CSS-6764 update cloud creds #1134

Merged

Conversation

kian99
Copy link
Contributor

@kian99 kian99 commented Jan 15, 2024

Description

This PR builds on #1127, it adds a facade method for UpdateServiceAccountCredentials. The facade method calls the same an underlying JIMM method as the Juju facade handlers for updating user cloud credentials.

Note that the rpc handler checks that the user has permission to manage the service account, we do this check in the jujuapi package whereas we normally do this check in the jimm package. I've had to write the tests slightly differently from the norm to account for this - specifically I've add an exported SetUser function in JIMM's controllerRoot.

Fixes CSS-6764

Engineering checklist

Check only items that apply

  • Documentation updated
  • Covered by unit tests
  • Covered by integration tests

Copy link
Collaborator

@alesstimec alesstimec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM modulo a few comments

api/params/params.go Show resolved Hide resolved
api/params/params.go Outdated Show resolved Hide resolved
api/params/params.go Show resolved Hide resolved
internal/jujuapi/service_account.go Show resolved Hide resolved
internal/jujuapi/cloud.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ale8k ale8k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm bar ales' comments

@kian99 kian99 force-pushed the CSS-6764-update-cloud-creds branch 4 times, most recently from ddf4f66 to 0b696b8 Compare January 16, 2024 21:55
@@ -129,6 +130,14 @@ func newControllerRoot(j JIMM, p Params) *controllerRoot {
return r
}

// SetUser sets the logged in user.
// Exported for test purposes.
func (r *controllerRoot) SetUser(u *openfga.User) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: doesn't need to be exported.. you can create a method in export_test.go

var SetUser = func(r *controllerRoot, u *openfga.User) {
	r.mu.Lock()
        r.user = u
	r.mu.Unlock()
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@kian99 kian99 force-pushed the CSS-6764-update-cloud-creds branch from 0b696b8 to 3910752 Compare January 17, 2024 00:48
@kian99 kian99 force-pushed the CSS-6764-update-cloud-creds branch from 3910752 to ac99084 Compare January 17, 2024 17:16
@kian99 kian99 mentioned this pull request Jan 17, 2024
3 tasks
@kian99 kian99 merged commit 732a120 into canonical:feature-serviceaccounts Jan 17, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants