Skip to content

Commit a7f755d

Browse files
committed
removed unnecessary change
1 parent 9c3567d commit a7f755d

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

coderd/rbac/authz.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ const (
7777
// Subject is a struct that contains all the elements of a subject in an rbac
7878
// authorize.
7979
type Subject struct {
80-
// Type indicates what kind of subject this is (user, system, provisioner, etc.)
81-
// It is not used in any functional way, only for logging.
82-
Type SubjectType
83-
8480
// FriendlyName is entirely optional and is used for logging and debugging
8581
// It is not used in any functional way.
8682
// It is usually the "username" of the user, but it can be the name of the
@@ -98,6 +94,10 @@ type Subject struct {
9894

9995
// cachedASTValue is the cached ast value for this subject.
10096
cachedASTValue ast.Value
97+
98+
// Type indicates what kind of subject this is (user, system, provisioner, etc.)
99+
// It is not used in any functional way, only for logging.
100+
Type SubjectType
101101
}
102102

103103
// RegoValueOk is only used for unit testing. There is no easy way
@@ -360,11 +360,10 @@ func NewAuthorizer(registry prometheus.Registerer) *RegoAuthorizer {
360360
}
361361

362362
type authSubject struct {
363-
Type SubjectType `json:"type"`
364-
ID string `json:"id"`
365-
Roles []Role `json:"roles"`
366-
Groups []string `json:"groups"`
367-
Scope Scope `json:"scope"`
363+
ID string `json:"id"`
364+
Roles []Role `json:"roles"`
365+
Groups []string `json:"groups"`
366+
Scope Scope `json:"scope"`
368367
}
369368

370369
// Authorize is the intended function to be used outside this package.

coderd/rbac/roles_internal_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
// A possible large improvement would be to implement the ast.Value interface directly.
2121
func BenchmarkRBACValueAllocation(b *testing.B) {
2222
actor := Subject{
23-
Type: SubjectTypeUser,
2423
Roles: RoleIdentifiers{ScopedRoleOrgMember(uuid.New()), ScopedRoleOrgAdmin(uuid.New()), RoleMember()},
2524
ID: uuid.NewString(),
2625
Scope: ScopeAll,
@@ -40,7 +39,6 @@ func BenchmarkRBACValueAllocation(b *testing.B) {
4039
})
4140

4241
jsonSubject := authSubject{
43-
Type: actor.Type,
4442
ID: actor.ID,
4543
Roles: must(actor.Roles.Expand()),
4644
Groups: actor.Groups,
@@ -84,7 +82,6 @@ func TestRegoInputValue(t *testing.T) {
8482
}
8583

8684
actor := Subject{
87-
Type: SubjectTypeUser,
8885
Roles: Roles(roles),
8986
ID: uuid.NewString(),
9087
Scope: ScopeAll,
@@ -112,7 +109,6 @@ func TestRegoInputValue(t *testing.T) {
112109
// This is the input that would be passed to the rego policy.
113110
jsonInput := map[string]interface{}{
114111
"subject": authSubject{
115-
Type: actor.Type,
116112
ID: actor.ID,
117113
Roles: must(actor.Roles.Expand()),
118114
Groups: actor.Groups,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy