Commit 18223058 authored by john's avatar john
Browse files

remove const from loops

parent b28e9840
......@@ -7,7 +7,7 @@ function isOwner (user, object) {
return false
}
for (const ownerId of object.owners) {
for (let ownerId of object.owners) {
if (ownerId === user.id) {
return true
}
......@@ -19,7 +19,7 @@ function teamPermissions (user, operation, object) {
return false
}
for (const team of user.teams) {
for (let team of user.teams) {
if (team.teamType.permissions === 'create' &&
team.object.id === object.id &&
operation === 'create') {
......
......@@ -36,14 +36,14 @@ function can (user, operation, object) {
if (user.admin === true) return true
for (const objectOwnerId of object.owners) {
for (let objectOwnerId of object.owners) {
if (objectOwnerId === user.id) {
return true
}
}
if (Array.isArray(object.parents)) {
for (const parent of object.parents) {
for (let parent of object.parents) {
if (parent.owners.includes(user)) {
return true
}
......@@ -52,7 +52,7 @@ function can (user, operation, object) {
// Teams
for (const team of user.teams) {
for (let team of user.teams) {
if (team.teamType.active) {
if (isAllowed(operation, team.teamType.permissions) &&
team.object === object &&
......@@ -72,7 +72,7 @@ function can (user, operation, object) {
if ((object.state === 'submitted' || object.state === undefined) &&
Array.isArray(object.parents)) {
for (const parent of object.parents) {
for (let parent of object.parents) {
if (can(user, operation, parent)) {
return true
}
......
......@@ -5,7 +5,7 @@ var noon = function (user, operation, object) {
if (user.admin === true) return true
if (operation === 'update' || operation === 'delete') {
for (const fragmentOwnerId of fragment.owners) {
for (let fragmentOwnerId of fragment.owners) {
if (fragmentOwnerId === user.id) {
return true
}
......@@ -13,14 +13,14 @@ var noon = function (user, operation, object) {
}
if (operation === 'create') {
for (const collectionOwnerId of collection.owners) {
for (let collectionOwnerId of collection.owners) {
if (collectionOwnerId === user.id) {
return true
}
}
}
for (const team of user.teams) {
for (let team of user.teams) {
if (team.teamType.active()) {
if (team.teamType.permissions === 'all' &&
team.object === collection &&
......
Supports Markdown
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