1
Fork 0
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:
Juliusz Chroboczek 2021-07-30 19:26:34 +02:00
parent a25d46314a
commit a5c97fd849
4 changed files with 5 additions and 11 deletions

View file

@ -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{} {

View file

@ -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

View file

@ -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

View file

@ -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,