-
Notifications
You must be signed in to change notification settings - Fork 0
/
roles.go
45 lines (39 loc) · 1.26 KB
/
roles.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package teleport
import (
"fmt"
"strings"
"github.com/gravitational/trace"
)
// Role identifies the role of SSH server connection
type Role string
// String returns debug-friendly representation of this role
func (r Role) String() string {
return fmt.Sprintf("%v", strings.ToUpper(string(r)))
}
// Check checks if this a a valid role value, returns nil
// if it's ok, false otherwise
func (r Role) Check() error {
switch r {
case RoleAuth, RoleUser, RoleWeb, RoleNode, RoleAdmin, RoleProvisionToken, RoleSignup, RoleProxy:
return nil
}
return trace.Wrap(BadParameter("role", fmt.Sprintf("%v is not supported", r)))
}
const (
// RoleAuth is for teleport auth server (authority, authentication and authorization)
RoleAuth Role = "Auth"
// RoleUser is a role for teleport SSH user
RoleUser Role = "User"
// RoleWeb is for web access users
RoleWeb Role = "Web"
// RoleNode is a role for SSH node in the cluster
RoleNode Role = "Node"
// RoleProxy is a role for SSH proxy in the cluster
RoleProxy Role = "Proxy"
// RoleAdmin is admin role
RoleAdmin Role = "Admin"
// RoleProvisionToken is a role for nodes authenticated using provisioning tokens
RoleProvisionToken Role = "ProvisionToken"
// RoleSignup is for first time signing up users
RoleSignup Role = "Signup"
)