Skip to content
Snippets Groups Projects
Commit 1d2f2630 authored by Andrei Cioromila's avatar Andrei Cioromila
Browse files

refactor(authsome): Remove validation for unused route

parent a6d8d863
No related branches found
No related tags found
2 merge requests!110Sprint 21 Features,!78Fix/hin 1022
...@@ -60,32 +60,6 @@ const createPaths = ['/collections', '/collections/:collectionId/fragments'] ...@@ -60,32 +60,6 @@ const createPaths = ['/collections', '/collections/:collectionId/fragments']
async function applyAuthenticatedUserPolicy(user, operation, object, context) { async function applyAuthenticatedUserPolicy(user, operation, object, context) {
if (operation === 'GET') { if (operation === 'GET') {
if (get(object, 'path') === '/collections') {
return {
filter: async collections => {
const userPermissions = await helpers.getUserPermissions({
user,
Team: context.models.Team,
})
return collections.filter(collection => {
if (collection.owners.includes(user.id)) {
return true
}
const collectionPermission = userPermissions.find(
p => p.objectId === collection.id,
)
if (collectionPermission) {
return true
}
return userPermissions.find(p =>
collection.fragments.includes(p.objectId),
)
})
},
}
}
if (get(object, 'path') === '/api/users') { if (get(object, 'path') === '/api/users') {
return helpers.getUsersList({ UserModel: context.models.User, user }) return helpers.getUsersList({ UserModel: context.models.User, user })
} }
......
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