mirror of
https://github.com/jech/galene.git
synced 2024-11-09 18:25:58 +01:00
Add System permission.
This replaces the OverridePermissions method, and is communicated to clients that can reliably and safely identify a system user.
This commit is contained in:
parent
a25d46314a
commit
a5c97fd849
4 changed files with 5 additions and 11 deletions
|
@ -63,16 +63,14 @@ func (client *Client) Challenge(group string, cred group.ClientCredentials) bool
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (client *Client) OverridePermissions(g *group.Group) bool {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (client *Client) SetPermissions(perms group.ClientPermissions) {
|
func (client *Client) SetPermissions(perms group.ClientPermissions) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (client *Client) Permissions() group.ClientPermissions {
|
func (client *Client) Permissions() group.ClientPermissions {
|
||||||
return group.ClientPermissions{}
|
return group.ClientPermissions{
|
||||||
|
System: true,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (client *Client) Status() map[string]interface{} {
|
func (client *Client) Status() map[string]interface{} {
|
||||||
|
|
|
@ -85,6 +85,7 @@ type ClientPermissions struct {
|
||||||
Op bool `json:"op,omitempty"`
|
Op bool `json:"op,omitempty"`
|
||||||
Present bool `json:"present,omitempty"`
|
Present bool `json:"present,omitempty"`
|
||||||
Record bool `json:"record,omitempty"`
|
Record bool `json:"record,omitempty"`
|
||||||
|
System bool `json:"system,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Challengeable interface {
|
type Challengeable interface {
|
||||||
|
@ -99,7 +100,6 @@ type Client interface {
|
||||||
Permissions() ClientPermissions
|
Permissions() ClientPermissions
|
||||||
SetPermissions(ClientPermissions)
|
SetPermissions(ClientPermissions)
|
||||||
Status() map[string]interface{}
|
Status() map[string]interface{}
|
||||||
OverridePermissions(*Group) bool
|
|
||||||
PushConn(g *Group, id string, conn conn.Up, tracks []conn.UpTrack, replace string) error
|
PushConn(g *Group, id string, conn conn.Up, tracks []conn.UpTrack, replace string) error
|
||||||
RequestConns(target Client, g *Group, id string) error
|
RequestConns(target Client, g *Group, id string) error
|
||||||
Joined(group, kind string) error
|
Joined(group, kind string) error
|
||||||
|
|
|
@ -485,7 +485,7 @@ func AddClient(group string, c Client) (*Group, error) {
|
||||||
|
|
||||||
clients := g.getClientsUnlocked(nil)
|
clients := g.getClientsUnlocked(nil)
|
||||||
|
|
||||||
if !c.OverridePermissions(g) {
|
if !c.Permissions().System {
|
||||||
perms, err := g.description.GetPermission(group, c)
|
perms, err := g.description.GetPermission(group, c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -107,10 +107,6 @@ func (c *webClient) SetPermissions(perms group.ClientPermissions) {
|
||||||
c.permissions = perms
|
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 {
|
func (c *webClient) PushClient(group, kind, id, username string, permissions group.ClientPermissions, status map[string]interface{}) error {
|
||||||
return c.action(pushClientAction{
|
return c.action(pushClientAction{
|
||||||
group, kind, id, username, permissions, status,
|
group, kind, id, username, permissions, status,
|
||||||
|
|
Loading…
Reference in a new issue