mirror of
https://github.com/9001/copyparty.git
synced 2026-06-18 20:22:27 -06:00
auth: read (and admin) implies get (#1485)
and hides redundant get-permission in webui; closes #1483
This commit is contained in:
parent
3b53a228b0
commit
0bb80e9294
|
|
@ -1663,7 +1663,8 @@ class AuthSrv(object):
|
||||||
for alias, mapping in [
|
for alias, mapping in [
|
||||||
("h", "gh"),
|
("h", "gh"),
|
||||||
("G", "gG"),
|
("G", "gG"),
|
||||||
("A", "rwmda.A"),
|
("r", "g"),
|
||||||
|
("A", "rgwmda.A"),
|
||||||
]:
|
]:
|
||||||
expanded = ""
|
expanded = ""
|
||||||
for ch in mapping:
|
for ch in mapping:
|
||||||
|
|
|
||||||
|
|
@ -6443,6 +6443,7 @@ class HttpCli(object):
|
||||||
s_wr = "write" in req["perms"]
|
s_wr = "write" in req["perms"]
|
||||||
s_get = "get" in req["perms"]
|
s_get = "get" in req["perms"]
|
||||||
s_dot = "dot" in req["perms"]
|
s_dot = "dot" in req["perms"]
|
||||||
|
# will_read, will_write, will_move, will_del, will_get
|
||||||
s_axs = [s_rd, s_wr, False, False, s_get]
|
s_axs = [s_rd, s_wr, False, False, s_get]
|
||||||
s_axsd = s_axs + [s_dot]
|
s_axsd = s_axs + [s_dot]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4145,6 +4145,8 @@ var fileman = (function () {
|
||||||
if (this.textContent == 'write-only')
|
if (this.textContent == 'write-only')
|
||||||
for (var a = 0; a < pbtns.length; a++)
|
for (var a = 0; a < pbtns.length; a++)
|
||||||
clmod(pbtns[a], 'on', pbtns[a].textContent == 'write');
|
clmod(pbtns[a], 'on', pbtns[a].textContent == 'write');
|
||||||
|
if (this.textContent == 'get' && clgot(this, 'on') && has(perms, 'read'))
|
||||||
|
clmod(pbtns[0], 'on');
|
||||||
}
|
}
|
||||||
clmod(pbtns[0], 'on', 1);
|
clmod(pbtns[0], 'on', 1);
|
||||||
|
|
||||||
|
|
@ -8033,12 +8035,17 @@ function apply_perms(res) {
|
||||||
a.style.display = '';
|
a.style.display = '';
|
||||||
tt.att(QS('#ops'));
|
tt.att(QS('#ops'));
|
||||||
|
|
||||||
|
var v_perms = perms.slice(0);
|
||||||
|
var have_read = has(perms, 'read');
|
||||||
|
if (have_read)
|
||||||
|
apop(v_perms, 'get');
|
||||||
|
|
||||||
for (var a = 0; a < chk.length; a++)
|
for (var a = 0; a < chk.length; a++)
|
||||||
if (has(perms, chk[a]))
|
if (has(v_perms, chk[a]))
|
||||||
axs.push(chk[a].slice(0, 1).toUpperCase() + chk[a].slice(1));
|
axs.push(chk[a].slice(0, 1).toUpperCase() + chk[a].slice(1));
|
||||||
|
|
||||||
axs = axs.join('-');
|
axs = axs.join('-');
|
||||||
if (perms.length == 1) {
|
if (v_perms.length == 1) {
|
||||||
aclass = ' class="warn">';
|
aclass = ' class="warn">';
|
||||||
axs += '-Only';
|
axs += '-Only';
|
||||||
}
|
}
|
||||||
|
|
@ -8080,7 +8087,6 @@ function apply_perms(res) {
|
||||||
document.body.setAttribute('perms', perms.join(' '));
|
document.body.setAttribute('perms', perms.join(' '));
|
||||||
|
|
||||||
var have_write = has(perms, "write"),
|
var have_write = has(perms, "write"),
|
||||||
have_read = has(perms, "read"),
|
|
||||||
de = document.documentElement,
|
de = document.documentElement,
|
||||||
tds = QSA('#u2conf td');
|
tds = QSA('#u2conf td');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue