Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit fa7a953

Browse files
Minor bugfixes (#16)
* Add a missing null check in `principal_get`. * Disable caching in the editor so we always see the latest information.
2 parents eab27be + 69a4834 commit fa7a953

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

editor/editor.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function get_token (service, renew) {
5151
return promise;
5252
}
5353

54-
async function fetch_json (service, path, method="GET", body=null) {
54+
async function fetch_json (service, path, method="GET", body=null, cache=false) {
5555
if (!(service in Services)) return;
5656
const url = new URL(path, Services[service]);
5757

@@ -60,6 +60,7 @@ async function fetch_json (service, path, method="GET", body=null) {
6060
const opts = {
6161
method,
6262
headers: { "Authorization": `Bearer ${token}` },
63+
cache: cache ? "default" : "no-cache",
6364
};
6465
if (body != null) {
6566
opts.body = JSON.stringify(body);
@@ -85,7 +86,9 @@ async function fetch_json (service, path, method="GET", body=null) {
8586
}
8687

8788
async function _get_name (obj) {
88-
const gi = await fetch_json("configdb", `v1/app/${Uuid.General_Info}/object/${obj}`);
89+
const gi = await fetch_json("configdb",
90+
`v1/app/${Uuid.General_Info}/object/${obj}`,
91+
"GET", null, true);
8992
return gi
9093
? gi.deleted
9194
? html`<s>${gi.name}</s>`
@@ -94,7 +97,9 @@ async function _get_name (obj) {
9497
}
9598

9699
async function get_name (obj) {
97-
const reg = await fetch_json("configdb", `v1/app/${Uuid.Registration}/object/${obj}`);
100+
const reg = await fetch_json("configdb",
101+
`v1/app/${Uuid.Registration}/object/${obj}`,
102+
"GET", null, true);
98103
const name = await _get_name(obj);
99104
const klass = reg ? await _get_name(reg.class) : html`<i>NO CLASS</i>`;
100105
return html`${name} <small>(${klass})</small>`;

lib/authz.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export default class AuthZ {
159159

160160
/* We can return 403 here as long as we don't return 404 until
161161
* we've checked the permissions. */
162-
const ok = req.auth == ids.kerberos
162+
const ok = req.auth == ids?.kerberos
163163
|| await this.model.check_acl(req.auth, Perm.Read_Krb, uuid, true);
164164
if (!ok) return res.status(403).end();
165165

0 commit comments

Comments
 (0)