1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 08:35:57 +01:00

Add canChangePassword to group status.

This commit is contained in:
Juliusz Chroboczek 2024-04-11 00:50:56 +02:00
parent 39d11c2f48
commit 077ff9a879

View file

@ -855,11 +855,11 @@ type Configuration struct {
modTime time.Time `json:"-"` modTime time.Time `json:"-"`
fileSize int64 `json:"-"` fileSize int64 `json:"-"`
PublicServer bool `json:"publicServer"` PublicServer bool `json:"publicServer"`
CanonicalHost string `json:"canonicalHost"` CanonicalHost string `json:"canonicalHost"`
ProxyURL string `json:"proxyURL"` ProxyURL string `json:"proxyURL"`
WritableGroups bool `json:"writableGroups"` WritableGroups bool `json:"writableGroups"`
Users map[string]UserDescription Users map[string]UserDescription
// obsolete fields // obsolete fields
Admin []ClientPattern `json:"admin"` Admin []ClientPattern `json:"admin"`
@ -1031,16 +1031,17 @@ func (g *Group) GetPermission(creds ClientCredentials) (string, []string, error)
} }
type Status struct { type Status struct {
Name string `json:"name"` Name string `json:"name"`
Redirect string `json:"redirect,omitempty"` Redirect string `json:"redirect,omitempty"`
Location string `json:"location,omitempty"` Location string `json:"location,omitempty"`
Endpoint string `json:"endpoint,omitempty"` Endpoint string `json:"endpoint,omitempty"`
DisplayName string `json:"displayName,omitempty"` DisplayName string `json:"displayName,omitempty"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
AuthServer string `json:"authServer,omitempty"` AuthServer string `json:"authServer,omitempty"`
AuthPortal string `json:"authPortal,omitempty"` AuthPortal string `json:"authPortal,omitempty"`
Locked bool `json:"locked,omitempty"` Locked bool `json:"locked,omitempty"`
ClientCount *int `json:"clientCount,omitempty"` ClientCount *int `json:"clientCount,omitempty"`
CanChangePassword bool `json:"canChangePassword,omitempty"`
} }
// Status returns a group's status. // Status returns a group's status.
@ -1097,6 +1098,12 @@ func (g *Group) Status(authentified bool, base *url.URL) Status {
d.Locked = locked d.Locked = locked
d.ClientCount = &count d.ClientCount = &count
} }
if authentified {
conf, err := GetConfiguration()
if err == nil {
d.CanChangePassword = conf.WritableGroups
}
}
return d return d
} }