Skip to content

Commit

Permalink
chore: add missing docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
kian99 committed Jan 6, 2025
1 parent 18f62a8 commit d515fbb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions internal/jimm/jimm.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,31 @@ type PermissionManager interface {
// ListObjectRelations lists all the tuples that an object has a direct relation with.
ListObjectRelations(ctx context.Context, user *openfga.User, object string, pageSize int32, entitlementToken pagination.EntitlementToken) ([]openfga.Tuple, pagination.EntitlementToken, error)

// GetJimmControllerAccess returns the user's level of access to JIMM.
GetJimmControllerAccess(ctx context.Context, user *openfga.User, tag names.UserTag) (string, error)
// GetUserCloudAccess returns the user's level of access to a cloud.
GetUserCloudAccess(ctx context.Context, user *openfga.User, cloud names.CloudTag) (string, error)
// GetUserModelAccess returns the user's level of access to a model.
GetUserModelAccess(ctx context.Context, user *openfga.User, model names.ModelTag) (string, error)

// GrantAuditLogAccess grants a user access to read audit logs.
GrantAuditLogAccess(ctx context.Context, user *openfga.User, targetUserTag names.UserTag) error
// GrantCloudAccess grants the user the specified access to a cloud.
GrantCloudAccess(ctx context.Context, user *openfga.User, ct names.CloudTag, ut names.UserTag, access string) error
// GrantModelAccess grants the user the specified access to a model.
GrantModelAccess(ctx context.Context, user *openfga.User, mt names.ModelTag, ut names.UserTag, access jujuparams.UserAccessPermission) error
// GrantOfferAccess grants the user the specified access to an offer.
GrantOfferAccess(ctx context.Context, u *openfga.User, offerURL string, ut names.UserTag, access jujuparams.OfferAccessPermission) error
// GrantServiceAccountAccess grants a user access to manage a service account.
GrantServiceAccountAccess(ctx context.Context, u *openfga.User, svcAccTag jimmnames.ServiceAccountTag, entities []string) error

// RevokeAuditLogAccess revokes a user's access to read audit logs.
RevokeAuditLogAccess(ctx context.Context, user *openfga.User, targetUserTag names.UserTag) error
// RevokeCloudAccess revokes the specified access to a cloud.
RevokeCloudAccess(ctx context.Context, user *openfga.User, ct names.CloudTag, ut names.UserTag, access string) error
// RevokeModelAccess revokes the specified access to a model.
RevokeModelAccess(ctx context.Context, user *openfga.User, mt names.ModelTag, ut names.UserTag, access jujuparams.UserAccessPermission) error
// RevokeOfferAccess revokes the specified access to an offer.
RevokeOfferAccess(ctx context.Context, user *openfga.User, offerURL string, ut names.UserTag, access jujuparams.OfferAccessPermission) (err error)

// OpenFGACleanup removes tuples that are no longer valid.
Expand Down Expand Up @@ -390,10 +399,14 @@ func (j *JIMM) LoginManager() LoginManager {
return j.loginManager
}

// PermissionManager returns a manager that enables permission checks and
// permissions grants/revocations.
func (j *JIMM) PermissionManager() PermissionManager {
return j.permissionManager
}

// NewJujuAuthenticator returns a new token generator for authenticating
// requests to a Juju controller.
func (j *JIMM) NewJujuAuthenticator() jujuauth.TokenGenerator {
return j.jujuAuthFactory.New()
}
Expand Down
3 changes: 2 additions & 1 deletion internal/jimm/permissions/tagresolver.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright 2024 Canonical.
// Copyright 2025 Canonical.

package permissions

import (
Expand Down

0 comments on commit d515fbb

Please sign in to comment.