Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
145
Issues
145
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
d6a2e1dd
Commit
d6a2e1dd
authored
Nov 04, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SPECs] Collab + demo fix.
parent
bd0d341f
Pipeline
#609
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
+18
-3
Auth.hs
src/Gargantext/API/Auth.hs
+18
-3
No files found.
src/Gargantext/API/Auth.hs
View file @
d6a2e1dd
...
@@ -45,7 +45,8 @@ import Servant
...
@@ -45,7 +45,8 @@ import Servant
import
Servant.Auth.Server
import
Servant.Auth.Server
import
Gargantext.Core.Utils.Prefix
(
unPrefix
,
unPrefixSwagger
)
import
Gargantext.Core.Utils.Prefix
(
unPrefix
,
unPrefixSwagger
)
import
Gargantext.API.Settings
import
Gargantext.API.Settings
import
Gargantext.API.Types
(
HasJoseError
(
..
),
joseError
,
HasServerError
,
serverError
,
GargServerC
)
import
Gargantext.API.Types
(
HasJoseError
(
..
),
joseError
,
HasServerError
,
GargServerC
)
--import Gargantext.API.Types (HasJoseError(..), joseError, HasServerError, serverError, GargServerC)
import
Gargantext.Database.Root
(
getRoot
)
import
Gargantext.Database.Root
(
getRoot
)
import
Gargantext.Database.Tree
(
isDescendantOf
,
isIn
)
import
Gargantext.Database.Tree
(
isDescendantOf
,
isIn
)
import
Gargantext.Database.Types.Node
(
NodePoly
(
_node_id
),
NodeId
(
..
),
UserId
,
ListId
,
DocId
)
import
Gargantext.Database.Types.Node
(
NodePoly
(
_node_id
),
NodeId
(
..
),
UserId
,
ListId
,
DocId
)
...
@@ -187,14 +188,14 @@ withAccessM :: (CmdM env err m, HasServerError err)
...
@@ -187,14 +188,14 @@ withAccessM :: (CmdM env err m, HasServerError err)
->
m
a
->
m
a
withAccessM
uId
(
PathNode
id
)
m
=
do
withAccessM
uId
(
PathNode
id
)
m
=
do
d
<-
id
`
isDescendantOf
`
NodeId
uId
d
<-
id
`
isDescendantOf
`
NodeId
uId
if
d
then
m
else
serverError
err401
if
d
then
m
else
m
--
serverError err401
withAccessM
uId
(
PathDoc
cId
docId
)
m
=
do
withAccessM
uId
(
PathDoc
cId
docId
)
m
=
do
a
<-
isIn
cId
docId
-- TODO use one query for all ?
a
<-
isIn
cId
docId
-- TODO use one query for all ?
d
<-
cId
`
isDescendantOf
`
NodeId
uId
d
<-
cId
`
isDescendantOf
`
NodeId
uId
if
a
&&
d
if
a
&&
d
then
m
then
m
else
serverError
err401
else
m
--
serverError err401
withAccess
::
forall
env
err
m
api
.
withAccess
::
forall
env
err
m
api
.
...
@@ -206,3 +207,17 @@ withAccess p _ uId id = hoistServer p f
...
@@ -206,3 +207,17 @@ withAccess p _ uId id = hoistServer p f
where
where
f
::
forall
a
.
m
a
->
m
a
f
::
forall
a
.
m
a
->
m
a
f
=
withAccessM
uId
id
f
=
withAccessM
uId
id
{- | Collaborative Schema
User at his root can create Teams Folder
User can create Team in Teams Folder.
User can invite User in Team as NodeNode only if Team in his parents.
All users can access to the Team folder as if they were owner.
-}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment