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
153
Issues
153
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
f81ecca6
Unverified
Commit
f81ecca6
authored
Jan 24, 2019
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Comments about ACCESS and EVENTS
parent
7aa33462
Pipeline
#142
failed with stage
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
52 additions
and
8 deletions
+52
-8
API.hs
src/Gargantext/API.hs
+4
-2
Count.hs
src/Gargantext/API/Count.hs
+2
-0
Node.hs
src/Gargantext/API/Node.hs
+31
-5
Search.hs
src/Gargantext/API/Search.hs
+2
-0
Flow.hs
src/Gargantext/Database/Flow.hs
+7
-1
Insert.hs
src/Gargantext/Database/Node/Document/Insert.hs
+2
-0
Ngrams.hs
src/Gargantext/Database/Schema/Ngrams.hs
+2
-0
NodeNgram.hs
src/Gargantext/Database/Schema/NodeNgram.hs
+2
-0
No files found.
src/Gargantext/API.hs
View file @
f81ecca6
...
...
@@ -248,10 +248,12 @@ type GargAPI' =
:>
QueryParam
"limit"
Int
:>
QueryParam
"order"
OrderBy
:>
SearchAPI
-- TODO move to NodeAPI?
:<|>
"graph"
:>
Summary
"Graph endpoint"
:>
Capture
"id"
NodeId
:>
GraphAPI
-- TODO move to NodeAPI?
-- Tree endpoint
:<|>
"tree"
:>
Summary
"Tree endpoint"
:>
Capture
"id"
NodeId
:>
TreeAPI
...
...
src/Gargantext/API/Count.hs
View file @
f81ecca6
...
...
@@ -44,6 +44,8 @@ import Gargantext.Prelude
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
-----------------------------------------------------------------------
-- TODO-ACCESS: CanCount
-- TODO-EVENTS: No events as this is a read only query.
type
CountAPI
=
Post
'[
J
SON
]
Counts
-----------------------------------------------------------------------
...
...
src/Gargantext/API/Node.hs
View file @
f81ecca6
...
...
@@ -75,7 +75,11 @@ import Test.QuickCheck.Arbitrary (Arbitrary, arbitrary)
type
GargServer
api
=
forall
env
m
.
CmdM
env
ServantErr
m
=>
ServerT
api
m
-------------------------------------------------------------------
-- | TODO : access by admin only
-- TODO-ACCESS: access by admin only.
-- At first let's just have an isAdmin check.
-- Later: check userId CanDeleteNodes Nothing
-- TODO-EVENTS: DeletedNodes [NodeId]
-- {"tag": "DeletedNodes", "nodes": [Int*]}
type
NodesAPI
=
Delete
'[
J
SON
]
Int
-- | Delete Nodes
...
...
@@ -85,8 +89,13 @@ nodesAPI :: [NodeId] -> GargServer NodesAPI
nodesAPI
ids
=
deleteNodes
ids
------------------------------------------------------------------------
-- | TODO: access by admin only
-- To manager the Users roots
-- | TODO-ACCESS: access by admin only.
-- At first let's just have an isAdmin check.
-- Later: CanAccessAnyNode or (CanGetAnyNode, CanPutAnyNode)
-- To manage the Users roots
-- TODO-EVENTS:
-- PutNode ?
-- TODO needs design discussion.
type
Roots
=
Get
'[
J
SON
]
[
NodeAny
]
:<|>
Put
'[
J
SON
]
Int
-- TODO
...
...
@@ -97,10 +106,21 @@ roots = (liftIO (putStrLn ( "/user" :: Text)) >> getNodesWithParentId 0 Nothing)
-------------------------------------------------------------------
-- | Node API Types management
-- TODO : access by users
-- TODO-ACCESS : access by users
-- No ownership check is needed if we strictly follow the capability model.
--
-- CanGetNode (Node, Children, TableApi, TableNgramsApiGet, PairingApi, ChartApi,
-- SearchAPI)
-- CanRenameNode (or part of CanEditNode?)
-- CanCreateChildren (PostNodeApi)
-- CanEditNode / CanPutNode TODO not implemented yet
-- CanDeleteNode
-- CanPatch (TableNgramsApi)
-- CanFavorite
-- CanMoveToTrash
type
NodeAPI
a
=
Get
'[
J
SON
]
(
Node
a
)
:<|>
"rename"
:>
RenameApi
:<|>
PostNodeApi
:<|>
PostNodeApi
-- TODO move to children POST
:<|>
Put
'[
J
SON
]
Int
:<|>
Delete
'[
J
SON
]
Int
:<|>
"children"
:>
ChildrenApi
a
...
...
@@ -121,6 +141,8 @@ type NodeAPI a = Get '[JSON] (Node a)
:>
QueryParam
"order"
OrderBy
:>
SearchAPI
-- TODO-ACCESS: check userId CanRenameNode nodeId
-- TODO-EVENTS: NodeRenamed RenameNode or re-use some more general NodeEdited...
type
RenameApi
=
Summary
" Rename Node"
:>
ReqBody
'[
J
SON
]
RenameNode
:>
Put
'[
J
SON
]
[
Int
]
...
...
@@ -248,6 +270,8 @@ type ChartApi = Summary " Chart API"
-- :<|> "query" :> Capture "string" Text :> Get '[JSON] Text
------------------------------------------------------------------------
-- TODO-ACCESS: CanGetNode
-- TODO-EVENTS: No events as this is a read only query.
type
GraphAPI
=
Get
'[
J
SON
]
Graph
graphAPI
::
NodeId
->
GargServer
GraphAPI
...
...
@@ -302,6 +326,8 @@ instance HasTreeError ServantErr where
mk
TooManyRoots
=
err500
{
errBody
=
e
<>
"Too many root nodes"
}
type
TreeAPI
=
Get
'[
J
SON
]
(
Tree
NodeTree
)
-- TODO-ACCESS: CanTree or CanGetNode
-- TODO-EVENTS: No events as this is a read only query.
treeAPI
::
NodeId
->
GargServer
TreeAPI
treeAPI
=
treeDB
...
...
src/Gargantext/API/Search.hs
View file @
f81ecca6
...
...
@@ -85,6 +85,8 @@ instance ToSchema SearchResults where
defaultSchemaOptions
{
fieldLabelModifier
=
\
fieldLabel
->
drop
4
fieldLabel
}
-----------------------------------------------------------------------
-- TODO-ACCESS: CanSearch? or is it part of CanGetNode
-- TODO-EVENTS: No event, this is a read-only query.
type
SearchAPI
=
Post
'[
J
SON
]
SearchResults
-----------------------------------------------------------------------
...
...
src/Gargantext/Database/Flow.hs
View file @
f81ecca6
...
...
@@ -97,7 +97,13 @@ flowInsertAnnuaire name children = do
pure
(
ids
,
masterUserId
,
masterCorpusId
,
userId
,
userCorpusId
)
-- TODO-ACCESS:
-- check userId CanFillUserCorpus userCorpusId
-- check masterUserId CanFillMasterCorpus masterCorpusId
--
-- TODO-EVENTS:
-- InsertedNgrams ?
-- InsertedNodeNgrams ?
flowCorpus'
::
HasNodeError
err
=>
NodeType
->
[
HyperdataDocument
]
->
([
ReturnId
],
UserId
,
CorpusId
,
UserId
,
CorpusId
)
...
...
src/Gargantext/Database/Node/Document/Insert.hs
View file @
f81ecca6
...
...
@@ -113,6 +113,8 @@ import Database.PostgreSQL.Simple (formatQuery)
data
ToDbData
=
ToDbDocument
HyperdataDocument
|
ToDbContact
HyperdataContact
-- TODO-ACCESS: check uId CanInsertDoc pId && checkDocType nodeType
-- TODO-EVENTS: InsertedNodes
insertDocuments
::
UserId
->
ParentId
->
NodeType
->
[
ToDbData
]
->
Cmd
err
[
ReturnId
]
insertDocuments
uId
pId
nodeType
=
runPGSQuery
queryInsert
.
Only
.
Values
fields
.
prepare
uId
pId
nodeType
...
...
src/Gargantext/Database/Schema/Ngrams.hs
View file @
f81ecca6
...
...
@@ -193,9 +193,11 @@ indexNgramsTWith = fmap . indexNgramsWith
indexNgramsWith
::
(
NgramsTerms
->
NgramsId
)
->
Ngrams
->
NgramsIndexed
indexNgramsWith
f
n
=
NgramsIndexed
n
(
f
$
_ngramsTerms
n
)
-- TODO-ACCESS: access must not be checked here but when insertNgrams is called.
insertNgrams
::
[
Ngrams
]
->
Cmd
err
(
Map
NgramsTerms
NgramsId
)
insertNgrams
ns
=
fromList
<$>
map
(
\
(
NgramIds
i
t
)
->
(
t
,
i
))
<$>
(
insertNgrams'
ns
)
-- TODO-ACCESS: access must not be checked here but when insertNgrams' is called.
insertNgrams'
::
[
Ngrams
]
->
Cmd
err
[
NgramIds
]
insertNgrams'
ns
=
runPGSQuery
queryInsertNgrams
(
PGS
.
Only
$
Values
fields
ns
)
where
...
...
src/Gargantext/Database/Schema/NodeNgram.hs
View file @
f81ecca6
...
...
@@ -288,6 +288,8 @@ data NodeNgramsUpdate = NodeNgramsUpdate
}
-- TODO wrap these updates in a transaction.
-- TODO-ACCESS:
-- * check userId CanUpdateNgrams userListId
updateNodeNgrams
::
NodeNgramsUpdate
->
Cmd
err
()
updateNodeNgrams
nnu
=
do
updateNodeNgrams'
userListId
$
_nnu_lists_update
nnu
...
...
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