Skip to content

Commit b76f373

Browse files
committed
Add some comments
1 parent db04d67 commit b76f373

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

coderd/httpmw/authorize.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func Authorize(logger slog.Logger, auth *rbac.RegoAuthorizer, action rbac.Action
2020
return func(next http.Handler) http.Handler {
2121
return http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
2222
roles := UserRoles(r)
23-
object := authObject(r)
23+
object := rbacObject(r)
2424

2525
if object.Type == "" {
2626
panic("developer error: auth object has no type")
@@ -72,7 +72,7 @@ func Authorize(logger slog.Logger, auth *rbac.RegoAuthorizer, action rbac.Action
7272
type authObjectKey struct{}
7373

7474
// APIKey returns the API key from the ExtractAPIKey handler.
75-
func authObject(r *http.Request) rbac.Object {
75+
func rbacObject(r *http.Request) rbac.Object {
7676
obj, ok := r.Context().Value(authObjectKey{}).(rbac.Object)
7777
if !ok {
7878
panic("developer error: auth object middleware not provided")

coderd/rbac/builtin.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,11 @@ func IsOrgRole(roleName string) (string, bool) {
146146
}
147147

148148
// OrganizationRoles lists all roles that can be applied to an organization user
149-
// in the given organization.
149+
// in the given organization. This is the list of available roles,
150+
// and specific to an organization.
151+
//
150152
// This should be a list in a database, but until then we build
151-
// the list from the builtins.
153+
// the list from the builtins.
152154
func OrganizationRoles(organizationID uuid.UUID) []string {
153155
var roles []string
154156
for _, roleF := range builtInRoles {
@@ -166,8 +168,10 @@ func OrganizationRoles(organizationID uuid.UUID) []string {
166168
}
167169

168170
// SiteRoles lists all roles that can be applied to a user.
171+
// This is the list of available roles, and not specific to a user
172+
//
169173
// This should be a list in a database, but until then we build
170-
// the list from the builtins.
174+
// the list from the builtins.
171175
func SiteRoles() []string {
172176
var roles []string
173177
for role := range builtInRoles {

0 commit comments

Comments
 (0)