Documentation ¶
Index ¶
- Constants
- type User
- func (u *User) GetPluginPermissions(name string) [][]byte
- func (u *User) HasClusterAccess(cluster string) bool
- func (u *User) HasNamespaceAccess(cluster, namespace string) bool
- func (u *User) HasPluginAccess(plugin string) bool
- func (u *User) HasResourceAccess(cluster, namespace, name, verb string) bool
Constants ¶
const UserKey ctxKeyUser = 0
UserKey is the key that holds the user in a request context.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type User ¶
type User struct { Cluster string `json:"cluster"` Namespace string `json:"namespace"` Name string `json:"name"` ID string `json:"id"` Profile userv1.Profile `json:"profile"` Teams []userv1.TeamReference `json:"teams"` Permissions userv1.Permissions `json:"permissions"` Rows []dashboardv1.Row `json:"rows"` }
User is the structure of the user object saved in the request context. It contains the users id and permissions if authentication is enabled.
func GetUser ¶
GetUser returns a user from the given context if one is present. Returns the empty string if a user can not be found.
func (*User) GetPluginPermissions ¶ added in v0.8.0
GetPluginPermissions returns the custom plugin permissions for a user. For that the name of the plugin must be provided.
func (*User) HasClusterAccess ¶
HasClusterAccess checks if the user has access to the given cluster.
func (*User) HasNamespaceAccess ¶
HasNamespaceAccess checks if the user has access to the given namespace in the given cluster.
func (*User) HasPluginAccess ¶
HasPluginAccess checks if the user has access to the given plugin.
func (*User) HasResourceAccess ¶
HasResourceAccess checks if the user has access to the given resource in the given cluster and namespace.