mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Small fixes
This commit is contained in:
parent
60cc93a806
commit
bb8a542eed
@ -2,7 +2,7 @@ from flask import current_app, request
|
|||||||
from flask_login import current_user
|
from flask_login import current_user
|
||||||
from socket import gaierror
|
from socket import gaierror
|
||||||
from . import cqi
|
from . import cqi
|
||||||
from .. import db, logger, socketio
|
from .. import db, socketio
|
||||||
from ..decorators import socketio_login_required
|
from ..decorators import socketio_login_required
|
||||||
from ..events import connected_sessions
|
from ..events import connected_sessions
|
||||||
from ..models import Corpus, User
|
from ..models import Corpus, User
|
||||||
|
@ -16,10 +16,10 @@ class Permission:
|
|||||||
can be evaluated using the bitwise operator &. 3 equals to CREATE_JOB and
|
can be evaluated using the bitwise operator &. 3 equals to CREATE_JOB and
|
||||||
DELETE_JOB and so on.
|
DELETE_JOB and so on.
|
||||||
"""
|
"""
|
||||||
CREATE_JOB = 1
|
MANAGE_CORPORA = 1
|
||||||
DELETE_JOB = 2
|
MANAGE_JOBS = 2
|
||||||
# WRITE = 4
|
# PERMISSION_NAME = 4
|
||||||
# MODERATE = 8
|
# PERMISSION_NAME = 8
|
||||||
ADMIN = 16
|
ADMIN = 16
|
||||||
|
|
||||||
|
|
||||||
@ -78,14 +78,14 @@ class Role(db.Model):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def insert_roles():
|
def insert_roles():
|
||||||
"""
|
"""
|
||||||
Inserts roles into the databes. This has to be executed befor Users are
|
Inserts roles into the database. This has to be executed befor Users
|
||||||
added to the database. Otherwiese Users will not have a Role assigned
|
are added to the database. Otherwiese Users will not have a Role
|
||||||
to them. Order of the roles dictionary determines the ID of each role.
|
assigned to them. Order of the roles dictionary determines the ID of
|
||||||
User hast the ID 1 and Administrator has the ID 2.
|
each role. Users have the ID 1 and Administrators have the ID 2.
|
||||||
"""
|
"""
|
||||||
roles = {'User': [Permission.CREATE_JOB],
|
roles = {'User': [Permission.MANAGE_CORPORA, Permission.MANAGE_JOBS],
|
||||||
'Administrator': [Permission.ADMIN, Permission.CREATE_JOB,
|
'Administrator': [Permission.MANAGE_CORPORA,
|
||||||
Permission.DELETE_JOB]}
|
Permission.MANAGE_JOBS, Permission.ADMIN]}
|
||||||
default_role = 'User'
|
default_role = 'User'
|
||||||
for r in roles:
|
for r in roles:
|
||||||
role = Role.query.filter_by(name=r).first()
|
role = Role.query.filter_by(name=r).first()
|
||||||
@ -385,6 +385,7 @@ class CorpusFile(db.Model):
|
|||||||
self.dir, self.filename)
|
self.dir, self.filename)
|
||||||
element_tree = ET.parse(file)
|
element_tree = ET.parse(file)
|
||||||
text_node = element_tree.find('text')
|
text_node = element_tree.find('text')
|
||||||
|
# TODO: USE OR
|
||||||
text_node.set('address', self.address if self.address else "NULL")
|
text_node.set('address', self.address if self.address else "NULL")
|
||||||
text_node.set('author', self.author)
|
text_node.set('author', self.author)
|
||||||
text_node.set('booktitle', self.booktitle if self.booktitle else "NULL")
|
text_node.set('booktitle', self.booktitle if self.booktitle else "NULL")
|
||||||
|
Loading…
Reference in New Issue
Block a user