Commit a5c97fd8 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Add System permission.

This replaces the OverridePermissions method, and is communicated
to clients that can reliably and safely identify a system user.
parent a25d4631
......@@ -63,16 +63,14 @@ func (client *Client) Challenge(group string, cred group.ClientCredentials) bool
return true
}
func (client *Client) OverridePermissions(g *group.Group) bool {
return true
}
func (client *Client) SetPermissions(perms group.ClientPermissions) {
return
}
func (client *Client) Permissions() group.ClientPermissions {
return group.ClientPermissions{}
return group.ClientPermissions{
System: true,
}
}
func (client *Client) Status() map[string]interface{} {
......
......@@ -85,6 +85,7 @@ type ClientPermissions struct {
Op bool `json:"op,omitempty"`
Present bool `json:"present,omitempty"`
Record bool `json:"record,omitempty"`
System bool `json:"system,omitempty"`
}
type Challengeable interface {
......@@ -99,7 +100,6 @@ type Client interface {
Permissions() ClientPermissions
SetPermissions(ClientPermissions)
Status() map[string]interface{}
OverridePermissions(*Group) bool
PushConn(g *Group, id string, conn conn.Up, tracks []conn.UpTrack, replace string) error
RequestConns(target Client, g *Group, id string) error
Joined(group, kind string) error
......
......@@ -485,7 +485,7 @@ func AddClient(group string, c Client) (*Group, error) {
clients := g.getClientsUnlocked(nil)
if !c.OverridePermissions(g) {
if !c.Permissions().System {
perms, err := g.description.GetPermission(group, c)
if err != nil {
return nil, err
......
......@@ -107,10 +107,6 @@ func (c *webClient) SetPermissions(perms group.ClientPermissions) {
c.permissions = perms
}
func (c *webClient) OverridePermissions(g *group.Group) bool {
return false
}
func (c *webClient) PushClient(group, kind, id, username string, permissions group.ClientPermissions, status map[string]interface{}) error {
return c.action(pushClientAction{
group, kind, id, username, permissions, status,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment