Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9918c16

Browse files
committed
zObject does not need exported fields
1 parent a4e038f commit 9918c16

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

coderd/authz/object.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ var _ OrgResource = (*zObject)(nil)
2525
// that represents the set of workspaces you are trying to get access too.
2626
// Do not export this type, as it can be created from a resource type constant.
2727
type zObject struct {
28-
id string
29-
owner string
30-
OwnedByOrg string
28+
id string
29+
owner string
30+
orgOwner string
3131

32-
// ObjectType is "workspace", "project", "devurl", etc
33-
ObjectType ResourceType
32+
// objectType is "workspace", "project", "devurl", etc
33+
objectType ResourceType
3434
// TODO: SharedUsers?
3535
}
3636

@@ -39,21 +39,21 @@ func (z zObject) ID() string {
3939
}
4040

4141
func (z zObject) ResourceType() ResourceType {
42-
return z.ObjectType
42+
return z.objectType
4343
}
4444

4545
func (z zObject) OwnerID() string {
4646
return z.owner
4747
}
4848

4949
func (z zObject) OrgOwnerID() string {
50-
return z.OwnedByOrg
50+
return z.orgOwner
5151
}
5252

5353
// Org adds an org OwnerID to the resource
5454
//nolint:revive
5555
func (z zObject) Org(orgID string) zObject {
56-
z.OwnedByOrg = orgID
56+
z.orgOwner = orgID
5757
return z
5858
}
5959

coderd/authz/resources.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ func (t ResourceType) ResourceType() ResourceType {
2222
//nolint:revive
2323
func (r ResourceType) Org(orgID string) zObject {
2424
return zObject{
25-
OwnedByOrg: orgID,
26-
ObjectType: r,
25+
orgOwner: orgID,
26+
objectType: r,
2727
}
2828
}
2929

@@ -32,14 +32,14 @@ func (r ResourceType) Org(orgID string) zObject {
3232
func (r ResourceType) Owner(id string) zObject {
3333
return zObject{
3434
owner: id,
35-
ObjectType: r,
35+
objectType: r,
3636
}
3737
}
3838

3939
//nolint:revive
4040
func (r ResourceType) AsID(id string) zObject {
4141
return zObject{
4242
id: id,
43-
ObjectType: r,
43+
objectType: r,
4444
}
4545
}

0 commit comments

Comments
 (0)