Skip to content

Commit f4b7761

Browse files
committed
Public editing
1 parent f725f44 commit f4b7761

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

lib/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ function App () {
531531
}
532532

533533
async function authorize (req, res, next) {
534-
if (!req.url.startsWith('/user/') && !req.url.startWith('/public/')) {
534+
if (!req.url.startsWith('/user/') && !req.url.startsWith('/public/')) {
535535
next()
536536
return
537537
}

lib/auth/access.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ async function getPrivilege (userIds, path) {
8383
uri = uri.split('/').slice(0, -2).join('/')
8484
}
8585

86-
console.log(uri)
87-
8886
let user = await db.model.User.findAll({
8987
where: {
9088
id: userIds,
@@ -104,20 +102,20 @@ async function getPrivilege (userIds, path) {
104102
}
105103
})
106104

107-
let usernames = await db.model.User.findAll({
105+
let userUris = await db.model.User.findAll({
108106
where: {
109107
id: userIds,
110108
virtual: false
111109
}
112110
}).then(results => {
113-
return results.map(result => result.username)
111+
return results.map(result => databasePrefix + 'user/' + result.username)
114112
})
115113

116114
let owners = await getOwnedBy(uri, graph)
117115

118116
// If we're an owner, we upgrade the privilege
119117
owners.forEach(owner => {
120-
if (usernames.includes(owner)) {
118+
if (userUris.includes(owner)) {
121119
minPrivilege = 3
122120
}
123121
})

0 commit comments

Comments
 (0)