mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-03 20:02:47 +00:00 
			
		
		
		
	Small fixes
This commit is contained in:
		@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
    DELETE_JOB = 2
 | 
			
		||||
    # WRITE = 4
 | 
			
		||||
    # MODERATE = 8
 | 
			
		||||
    MANAGE_CORPORA = 1
 | 
			
		||||
    MANAGE_JOBS = 2
 | 
			
		||||
    # PERMISSION_NAME = 4
 | 
			
		||||
    # PERMISSION_NAME = 8
 | 
			
		||||
    ADMIN = 16
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -78,14 +78,14 @@ class Role(db.Model):
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def insert_roles():
 | 
			
		||||
        """
 | 
			
		||||
        Inserts roles into the databes. 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 hast the ID 1 and Administrator has the ID 2.
 | 
			
		||||
        Inserts roles into the database. 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. Users have the ID 1 and Administrators have the ID 2.
 | 
			
		||||
        """
 | 
			
		||||
        roles = {'User': [Permission.CREATE_JOB],
 | 
			
		||||
                 'Administrator': [Permission.ADMIN, Permission.CREATE_JOB,
 | 
			
		||||
                                   Permission.DELETE_JOB]}
 | 
			
		||||
        roles = {'User': [Permission.MANAGE_CORPORA, Permission.MANAGE_JOBS],
 | 
			
		||||
                 '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")
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user