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

Commit507fde0

Browse files
committed
fix some compile issus
1 parenta6b5d29 commit507fde0

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

‎coderd/rbac/object.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,20 @@ type Object struct {
3737
ACLGroupListmap[string][]policy.Action` json:"acl_group_list"`
3838
}
3939

40+
// AvailableActions returns all available actions for a given object.
41+
// Wildcard is omitted.
4042
func (zObject)AvailableActions() []policy.Action {
41-
policy.Action()
43+
perms,ok:=policy.RBACPermissions[z.Type]
44+
if!ok {
45+
return []policy.Action{}
46+
}
47+
48+
actions:=make([]policy.Action,0,len(perms.Actions))
49+
foraction:=rangeperms.Actions {
50+
actions=append(actions,action)
51+
}
52+
53+
returnactions
4254
}
4355

4456
func (zObject)Equal(bObject)bool {

‎coderd/rbac/policy/policy.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,11 @@ func (a ActionDefinition) Requires() string {
8282

8383
// RBACPermissions is indexed by the type
8484
varRBACPermissions=map[string]PermissionDefinition{
85+
// Wildcard is every object, and the action "*" provides all actions.
86+
// So can grant all actions on all types.
8587
WildcardSymbol: {
86-
Name:"Wildcard",
87-
Actions:map[Action]ActionDefinition{
88-
WildcardSymbol: {
89-
Description:"Wildcard gives admin level access to all resources and all actions.",
90-
Fields:0,
91-
},
92-
},
88+
Name:"Wildcard",
89+
Actions:map[Action]ActionDefinition{},
9390
},
9491
"user": {
9592
Actions:map[Action]ActionDefinition{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp