Commit eedfacca authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Add locked and displayName to public-groups.json.

parent 52a26327
...@@ -949,7 +949,9 @@ func (desc *Description) GetPermission(group string, c Challengeable) (ClientPer ...@@ -949,7 +949,9 @@ func (desc *Description) GetPermission(group string, c Challengeable) (ClientPer
type Public struct { type Public struct {
Name string `json:"name"` Name string `json:"name"`
DisplayName string `json:"displayName,omitempty"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
Locked bool `json:"locked,omitempty"`
ClientCount int `json:"clientCount"` ClientCount int `json:"clientCount"`
} }
...@@ -957,9 +959,12 @@ func GetPublic() []Public { ...@@ -957,9 +959,12 @@ func GetPublic() []Public {
gs := make([]Public, 0) gs := make([]Public, 0)
Range(func(g *Group) bool { Range(func(g *Group) bool {
if g.Public() { if g.Public() {
locked, _ := g.Locked()
gs = append(gs, Public{ gs = append(gs, Public{
Name: g.name, Name: g.name,
DisplayName: g.DisplayName(),
Description: g.description.Description, Description: g.description.Description,
Locked: locked,
ClientCount: len(g.clients), ClientCount: len(g.clients),
}) })
} }
......
...@@ -60,7 +60,7 @@ async function listPublicGroups() { ...@@ -60,7 +60,7 @@ async function listPublicGroups() {
let td = document.createElement('td'); let td = document.createElement('td');
let a = document.createElement('a'); let a = document.createElement('a');
a.textContent = group.name; a.textContent = group.name;
a.href = '/group/' + encodeURIComponent(group.name); a.href = '/group/' + encodeURIComponent(group.displayName || group.name);
td.appendChild(a); td.appendChild(a);
tr.appendChild(td); tr.appendChild(td);
let td2 = document.createElement('td'); let td2 = document.createElement('td');
...@@ -68,7 +68,8 @@ async function listPublicGroups() { ...@@ -68,7 +68,8 @@ async function listPublicGroups() {
td2.textContent = group.description; td2.textContent = group.description;
tr.appendChild(td2); tr.appendChild(td2);
let td3 = document.createElement('td'); let td3 = document.createElement('td');
td3.textContent = `(${group.clientCount} clients)`; let locked = group.locked ? ', locked' : '';
td3.textContent = `(${group.clientCount} clients${locked})`;
tr.appendChild(td3); tr.appendChild(td3);
table.appendChild(tr); table.appendChild(tr);
} }
......
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