Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
fb49488d
Commit
fb49488d
authored
Apr 28, 2015
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Improving user/group/node rights models.
parent
1cbc3d93
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
24 deletions
+40
-24
models.py
node/models.py
+40
-24
No files found.
node/models.py
View file @
fb49488d
...
...
@@ -38,30 +38,6 @@ def _upload_to(instance, filename):
# All classes here
class
Group
(
models
.
Model
):
creator
=
models
.
ForeignKey
(
User
)
name
=
models
.
CharField
(
max_length
=
255
,
unique
=
True
)
def
__str__
(
self
):
return
self
.
creator
,
self
.
name
class
UserGroup
(
models
.
Model
):
user
=
models
.
ForeignKey
(
User
)
group
=
models
.
ForeignKey
(
Group
)
def
__str__
(
self
):
return
self
.
user
,
self
.
group
class
NodeGroup
(
models
.
Model
):
node
=
models
.
ForeignKey
(
Node
)
group
=
models
.
ForeignKey
(
Group
)
rights
=
models
.
CharField
(
max_length
=
1
,
unique
=
True
)
def
__str__
(
self
):
return
self
.
node
,
self
.
group
,
self
.
rights
class
Language
(
models
.
Model
):
iso2
=
models
.
CharField
(
max_length
=
2
,
unique
=
True
)
iso3
=
models
.
CharField
(
max_length
=
3
,
unique
=
True
)
...
...
@@ -407,4 +383,44 @@ class NgramNgram(models.Model):
index
=
models
.
IntegerField
()
# Core Collaboration Structure
class
Group
(
models
.
Model
):
'''
The creator of the group is a user who
- is in it
- has all acccess by defautl
'''
creator
=
models
.
ForeignKey
(
User
)
name
=
models
.
CharField
(
max_length
=
255
,
unique
=
True
)
def
__str__
(
self
):
return
self
.
creator
,
self
.
name
class
UserGroup
(
models
.
Model
):
'''
User can have rights to the group:
- access (read)
- add/remove users from it (write)
'''
user
=
models
.
ForeignKey
(
User
)
group
=
models
.
ForeignKey
(
Group
)
rights
=
models
.
CharField
(
max_length
=
1
,
unique
=
True
)
def
__str__
(
self
):
return
self
.
user
,
self
.
group
class
NodeGroup
(
models
.
Model
):
'''
User can have rights on the node:
- can read (read as "r" rights)
- can modify, remove (write as "w" rights)
'''
node
=
models
.
ForeignKey
(
Node
)
group
=
models
.
ForeignKey
(
Group
)
rights
=
models
.
CharField
(
max_length
=
1
,
unique
=
True
)
def
__str__
(
self
):
return
self
.
node
,
self
.
group
,
self
.
rights
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