# Path: amivapi/settings.py
# DEPARTMENT_LIST = [
#     'itet',
#     'mavt',
#     'arch',
#     'baug',
#     'bsse',
#     'infk',
#     'matl',
#     'biol',
#     'chab',
#     'math',
#     'phys',
#     'erdw',
#     'usys',
#     'hest',
#     'mtec',
#     'gess'
# ]
# 
# Path: amivapi/studydocs/authorization.py
# class StudydocsAuth(AmivTokenAuth):
#     def has_item_write_permission(self, user_id, item):
#         return str(get_id(item['uploader'])) == user_id
# 
#     def has_resource_write_permission(self, user_id):
#         # All users can create studydocs
#         return True


from amivapi.settings import DEPARTMENT_LIST
from .authorization import StudydocsAuth
                'example': 'ea059fa90df4703316da25d8',

                'type': 'objectid',
                'data_relation': {
                    'resource': 'users',
                    'embeddable': True,
                },
                # Must be nullable: e.g. if root user uploads there is no user
                'nullable': True,
                'readonly': True,

            },
            'author': {
                'description': 'Original author of the uploaded files '
                               '(professor, assistant, copyright owner)',
                'example': "Pablo",

                'type': 'string',
                'maxlength': 100,
                'empty': False,
                'nullable': True,
                'default': None,
                'no_html': True,
                'allow_summary': True,
            },
            'department': {
                'example': DEPARTMENT_LIST[0],
                'type': 'string',
                'nullable': True,
                'default': None,

# Path: amivapi/settings.py
# DEPARTMENT_LIST = [
#     'itet',
#     'mavt',
#     'arch',
#     'baug',
#     'bsse',
#     'infk',
#     'matl',
#     'biol',
#     'chab',
#     'math',
#     'phys',
#     'erdw',
#     'usys',
#     'hest',
#     'mtec',
#     'gess'
# ]
# 
# Path: amivapi/studydocs/authorization.py
# class StudydocsAuth(AmivTokenAuth):
#     def has_item_write_permission(self, user_id, item):
#         return str(get_id(item['uploader'])) == user_id
# 
#     def has_resource_write_permission(self, user_id):
#         # All users can create studydocs
#         return True


# Path: amivapi/studydocs/model.py
from amivapi.settings import DEPARTMENT_LIST
from .authorization import StudydocsAuth

                'example': 'ea059fa90df4703316da25d8',

                'type': 'objectid',
                'data_relation': {
                    'resource': 'users',
                    'embeddable': True,
                },
                # Must be nullable: e.g. if root user uploads there is no user
                'nullable': True,
                'readonly': True,

            },
            'author': {
                'description': 'Original author of the uploaded files '
                               '(professor, assistant, copyright owner)',
                'example': "Pablo",

                'type': 'string',
                'maxlength': 100,
                'empty': False,
                'nullable': True,
                'default': None,
                'no_html': True,
                'allow_summary': True,
            },
            'department': {
                'example': DEPARTMENT_LIST[0],
                'type': 'string',
                'nullable': True,
                'default': None,

                'allowed': DEPARTMENT_LIST,