Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
X
xpub-faraday
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
xpub
xpub-faraday
Commits
4c330e22
Commit
4c330e22
authored
6 years ago
by
Sebastian Mihalache
Browse files
Options
Downloads
Patches
Plain Diff
feat(authsome): remove coverletter from file when reviewer
parent
9cb7a626
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!8
Sprint #10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
packages/xpub-faraday/config/authsome-helpers.js
+19
-7
19 additions, 7 deletions
packages/xpub-faraday/config/authsome-helpers.js
packages/xpub-faraday/config/authsome-mode.js
+11
-4
11 additions, 4 deletions
packages/xpub-faraday/config/authsome-mode.js
with
30 additions
and
11 deletions
packages/xpub-faraday/config/authsome-helpers.js
+
19
−
7
View file @
4c330e22
...
...
@@ -27,22 +27,34 @@ const filterRefusedInvitations = (coll, user) => {
return
coll
}
const
filterCollectionData
=
(
collectionsPermissions
,
collection
,
user
)
=>
{
const
filterObjectData
=
(
collectionsPermissions
,
object
,
user
)
=>
{
if
(
object
.
type
===
'
fragment
'
)
{
const
matchingCollPerm
=
collectionsPermissions
.
find
(
collPerm
=>
object
.
id
===
collPerm
.
fragmentId
,
)
if
(
matchingCollPerm
===
undefined
)
return
{}
if
([
'
reviewer
'
].
includes
(
matchingCollPerm
.
permission
))
{
object
.
files
=
omit
(
object
.
files
,
[
'
coverLetter
'
])
}
return
object
}
const
matchingCollPerm
=
collectionsPermissions
.
find
(
collPerm
=>
collection
.
id
===
collPerm
.
id
,
collPerm
=>
object
.
id
===
collPerm
.
id
,
)
setPublicStatuses
(
collection
,
matchingCollPerm
)
parseAuthorsData
(
collection
,
matchingCollPerm
)
if
(
matchingCollPerm
===
undefined
)
return
{}
setPublicStatuses
(
object
,
matchingCollPerm
)
parseAuthorsData
(
object
,
matchingCollPerm
)
if
([
'
reviewer
'
,
'
handlingEditor
'
].
includes
(
matchingCollPerm
.
permission
))
{
return
filterRefusedInvitations
(
collection
,
user
)
return
filterRefusedInvitations
(
object
,
user
)
}
return
collection
return
object
}
module
.
exports
=
{
parseAuthorsData
,
setPublicStatuses
,
filterRefusedInvitations
,
filter
Collection
Data
,
filter
Object
Data
,
}
This diff is collapsed.
Click to expand it.
packages/xpub-faraday/config/authsome-mode.js
+
11
−
4
View file @
4c330e22
...
...
@@ -4,7 +4,7 @@ const omit = require('lodash/omit')
const
helpers
=
require
(
'
./authsome-helpers
'
)
async
function
teamPermissions
(
user
,
operation
,
object
,
context
)
{
if
(
object
.
type
!==
'
collection
'
)
return
true
//
if (object.type !== 'collection') return true
const
permissions
=
[
'
handlingEditor
'
,
'
author
'
,
'
reviewer
'
]
const
teams
=
await
Promise
.
all
(
...
...
@@ -16,10 +16,17 @@ async function teamPermissions(user, operation, object, context) {
return
null
}),
)
const
objectType
=
get
(
object
,
'
type
'
)
let
fragmentId
=
null
if
(
objectType
!==
undefined
)
{
if
(
objectType
===
'
fragment
'
)
{
fragmentId
=
object
.
id
}
}
const
collectionsPermissions
=
teams
.
filter
(
Boolean
).
map
(
team
=>
({
id
:
team
.
object
.
id
,
permission
:
team
.
teamType
.
permissions
,
fragmentId
,
}))
if
(
collectionsPermissions
.
length
===
0
)
return
{}
...
...
@@ -27,7 +34,7 @@ async function teamPermissions(user, operation, object, context) {
return
{
filter
:
filterParam
=>
{
if
(
!
filterParam
.
length
)
{
return
helpers
.
filter
Collection
Data
(
return
helpers
.
filter
Object
Data
(
collectionsPermissions
,
filterParam
,
user
,
...
...
@@ -36,7 +43,7 @@ async function teamPermissions(user, operation, object, context) {
const
collections
=
filterParam
.
map
(
coll
=>
helpers
.
filter
Collection
Data
(
collectionsPermissions
,
coll
,
user
),
helpers
.
filter
Object
Data
(
collectionsPermissions
,
coll
,
user
),
)
.
filter
(
Boolean
)
return
collections
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment