Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add node access to userACL #4445

Merged
merged 1 commit into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 6 additions & 2 deletions lib/web/ui/usercontext.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ type userACL struct {
TrustedClusters access `json:"trustedClusters"`
// Events defines access to audit logs
Events access `json:"events"`
// Tokens defines access to creating tokens ie: node join token.
Tokens access `json:"nodeToken"`
// Tokens defines access to tokens.
Tokens access `json:"tokens"`
// Nodes defines access to nodes.
Nodes access `json:"nodes"`
// SSH defines access to servers
SSHLogins []string `json:"sshLogins"`
}
Expand Down Expand Up @@ -121,6 +123,7 @@ func NewUserContext(user services.User, userRoles services.RoleSet) (*userContex
eventAccess := newAccess(userRoles, ctx, services.KindEvent)
userAccess := newAccess(userRoles, ctx, services.KindUser)
tokenAccess := newAccess(userRoles, ctx, services.KindToken)
nodeAccess := newAccess(userRoles, ctx, services.KindNode)
logins := getLogins(userRoles)

acl := userACL{
Expand All @@ -132,6 +135,7 @@ func NewUserContext(user services.User, userRoles services.RoleSet) (*userContex
SSHLogins: logins,
Users: userAccess,
Tokens: tokenAccess,
Nodes: nodeAccess,
}

// local user
Expand Down
1 change: 1 addition & 0 deletions lib/web/ui/usercontext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func (s *UserContextSuite) TestNewUserContext(c *check.C) {
c.Assert(userContext.ACL.Roles, check.DeepEquals, denied)
c.Assert(userContext.ACL.Users, check.DeepEquals, denied)
c.Assert(userContext.ACL.Tokens, check.DeepEquals, denied)
c.Assert(userContext.ACL.Nodes, check.DeepEquals, denied)
c.Assert(userContext.ACL.SSHLogins, check.DeepEquals, []string{"a", "b", "d"})

// test local auth type
Expand Down