Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
bb8a542e
Commit
bb8a542e
authored
4 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Small fixes
parent
60cc93a8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/corpora/events.py
+1
-1
1 addition, 1 deletion
app/corpora/events.py
app/models.py
+12
-11
12 additions, 11 deletions
app/models.py
with
13 additions
and
12 deletions
app/corpora/events.py
+
1
−
1
View file @
bb8a542e
...
...
@@ -2,7 +2,7 @@ from flask import current_app, request
from
flask_login
import
current_user
from
socket
import
gaierror
from
.
import
cqi
from
..
import
db
,
logger
,
socketio
from
..
import
db
,
socketio
from
..decorators
import
socketio_login_required
from
..events
import
connected_sessions
from
..models
import
Corpus
,
User
...
...
This diff is collapsed.
Click to expand it.
app/models.py
+
12
−
11
View file @
bb8a542e
...
...
@@ -16,10 +16,10 @@ class Permission:
can be evaluated using the bitwise operator &. 3 equals to CREATE_JOB and
DELETE_JOB and so on.
"""
CREATE_JOB
=
1
DELET
E_JOB
=
2
#
WRIT
E = 4
#
MODERAT
E = 8
MANAGE_CORPORA
=
1
MANAG
E_JOB
S
=
2
#
PERMISSION_NAM
E = 4
#
PERMISSION_NAM
E = 8
ADMIN
=
16
...
...
@@ -78,14 +78,14 @@ class Role(db.Model):
@staticmethod
def
insert_roles
():
"""
Inserts roles into the databe
s
. This has to be executed befor Users
are
added to the database. Otherwiese Users will not have a Role
assigned
to them. Order of the roles dictionary determines the ID of
each role.
User ha
st
the ID 1 and Administrator ha
s
the ID 2.
Inserts roles into the datab
as
e. This has to be executed befor Users
are
added to the database. Otherwiese Users will not have a Role
assigned
to them. Order of the roles dictionary determines the ID of
each role.
User
s
ha
ve
the ID 1 and Administrator
s
ha
ve
the ID 2.
"""
roles
=
{
'
User
'
:
[
Permission
.
CREAT
E_JOB
],
'
Administrator
'
:
[
Permission
.
ADMIN
,
Permission
.
CREATE_JOB
,
Permission
.
DELETE_JOB
]}
roles
=
{
'
User
'
:
[
Permission
.
MANAGE_CORPORA
,
Permission
.
MANAG
E_JOB
S
],
'
Administrator
'
:
[
Permission
.
MANAGE_CORPORA
,
Permission
.
MANAGE_JOBS
,
Permission
.
ADMIN
]}
default_role
=
'
User
'
for
r
in
roles
:
role
=
Role
.
query
.
filter_by
(
name
=
r
).
first
()
...
...
@@ -385,6 +385,7 @@ class CorpusFile(db.Model):
self
.
dir
,
self
.
filename
)
element_tree
=
ET
.
parse
(
file
)
text_node
=
element_tree
.
find
(
'
text
'
)
# TODO: USE OR
text_node
.
set
(
'
address
'
,
self
.
address
if
self
.
address
else
"
NULL
"
)
text_node
.
set
(
'
author
'
,
self
.
author
)
text_node
.
set
(
'
booktitle
'
,
self
.
booktitle
if
self
.
booktitle
else
"
NULL
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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