Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: avoid depending on rbac in slim builds#17959

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethanndickson merged 2 commits intomainfromethan/avoid-rbac-dependency-slim
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from1 commit
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
PrevPrevious commit
single file compile guard, SiteRoles -> SiteBuiltInRoles
  • Loading branch information
@ethanndickson
ethanndickson committedMay 22, 2025
commit953816ad87cb9ccad95036eba48187141d4f3903
9 changes: 5 additions & 4 deletionscoderd/database/no_slim.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
//go:build slim

package database

const (
// This declaration protects against imports in slim builds, see
// no_slim_slim.go.
//nolint:revive,unused
_DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS = "DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS"
// This line fails to compile, preventing this package from being imported
// in slim builds.
_DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS = _DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS
)
14 changes: 0 additions & 14 deletionscoderd/database/no_slim_slim.go
View file
Open in desktop

This file was deleted.

9 changes: 5 additions & 4 deletionscoderd/rbac/no_slim.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
//go:build slim

package rbac

const (
// This declaration protects against imports in slim builds, see
// no_slim_slim.go.
//nolint:revive,unused
_DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS = "DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS"
// This line fails to compile, preventing this package from being imported
// in slim builds.
_DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS = _DO_NOT_IMPORT_THIS_PACKAGE_IN_SLIM_BUILDS
)
14 changes: 0 additions & 14 deletionscoderd/rbac/no_slim_slim.go
View file
Open in desktop

This file was deleted.

4 changes: 2 additions & 2 deletionscoderd/rbac/roles.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -798,12 +798,12 @@ func OrganizationRoles(organizationID uuid.UUID) []Role {
return roles
}

//SiteRoles lists all roles that can be applied to a user.
//SiteBuiltInRoles lists all roles that can be applied to a user.
// This is the list of available roles, and not specific to a user
//
// This should be a list in a database, but until then we build
// the list from the builtins.
funcSiteRoles() []Role {
funcSiteBuiltInRoles() []Role {
var roles []Role
for _, roleF := range builtInRoles {
// Must provide some non-nil uuid to filter out org roles.
Expand Down
4 changes: 2 additions & 2 deletionscoderd/rbac/roles_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,7 +34,7 @@ func (a authSubject) Subjects() []authSubject { return []authSubject{a} }
// rules. If this is incorrect, that is a mistake.
func TestBuiltInRoles(t *testing.T) {
t.Parallel()
for _, r := range rbac.SiteRoles() {
for _, r := range rbac.SiteBuiltInRoles() {
r := r
t.Run(r.Identifier.String(), func(t *testing.T) {
t.Parallel()
Expand DownExpand Up@@ -997,7 +997,7 @@ func TestIsOrgRole(t *testing.T) {
func TestListRoles(t *testing.T) {
t.Parallel()

siteRoles := rbac.SiteRoles()
siteRoles := rbac.SiteBuiltInRoles()
siteRoleNames := make([]string, 0, len(siteRoles))
for _, role := range siteRoles {
siteRoleNames = append(siteRoleNames, role.Identifier.Name)
Expand Down
2 changes: 1 addition & 1 deletioncoderd/roles.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,7 +43,7 @@ func (api *API) AssignableSiteRoles(rw http.ResponseWriter, r *http.Request) {
return
}

httpapi.Write(ctx, rw, http.StatusOK, assignableRoles(actorRoles.Roles, rbac.SiteRoles(), dbCustomRoles))
httpapi.Write(ctx, rw, http.StatusOK, assignableRoles(actorRoles.Roles, rbac.SiteBuiltInRoles(), dbCustomRoles))
}

// assignableOrgRoles returns all org wide roles that can be assigned.
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp