class Migration(migrations.Migration):
    permissions_to_add = [
        # codename, app, model
        # drives
        ['restore_drive', 'drives', 'drive'],
        ['trash_drive', 'drives', 'drive'],
        ['view_drive', 'drives', 'drive'],
        ['add_drive', 'drives', 'drive'],
        ['change_drive', 'drives', 'drive'],
        ['delete_drive', 'drives', 'drive'],
        ['change_project_drive', 'drives', 'drive']
    ]

    dependencies = [
        ('drives', '0002_add_create_without_project_permission_to_user_group'),
    ]

    operations = [
        # migrations.RunPython(forwards_func, reverse_func),
        migrations.RunPython(
            code=lambda *args, **kwargs:
            PermissionMigrationHelper.forwards_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs),
            reverse_code=lambda *args, **kwargs:
            PermissionMigrationHelper.reverse_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs)),
    ]
class Migration(migrations.Migration):
    permissions_to_add = [
        # codename, app, model
        ['view_project', 'projects', 'project'],
        [
            'view_projectroleuserassignment', 'projects',
            'projectroleuserassignment'
        ],
        ['view_resource', 'projects', 'resource'],
        ['view_file', 'shared_elements', 'file'],
        ['view_meeting', 'shared_elements', 'meeting'],
        ['view_note', 'shared_elements', 'note'],
        ['view_task', 'shared_elements', 'task'],
        ['view_contact', 'shared_elements', 'contact'],
        ['view_dmp', 'dmp', 'dmp'],
    ]

    dependencies = [
        ('projects', '0052_add_observer_role'),
    ]

    operations = [
        # migrations.RunPython(forwards_func, reverse_func),
        migrations.RunPython(
            code=lambda *args, **kwargs:
            PermissionMigrationHelper.forwards_func_observer(
                Migration.permissions_to_add, *args, **kwargs),
            reverse_code=lambda *args, **kwargs:
            PermissionMigrationHelper.reverse_func_observer(
                Migration.permissions_to_add, *args, **kwargs)),
    ]
class Migration(migrations.Migration):
    permissions_to_add = [
        # codename, app, model
        ['view_userattendsmeeting', 'shared_elements', 'userattendsmeeting'],
        ['add_userattendsmeeting', 'shared_elements', 'userattendsmeeting'],
        ['change_userattendsmeeting', 'shared_elements', 'userattendsmeeting'],
        ['delete_userattendsmeeting', 'shared_elements', 'userattendsmeeting'],

        ['view_contactattendsmeeting', 'shared_elements', 'contactattendsmeeting'],
        ['add_contactattendsmeeting', 'shared_elements', 'contactattendsmeeting'],
        ['change_contactattendsmeeting', 'shared_elements', 'contactattendsmeeting'],
        ['delete_contactattendsmeeting', 'shared_elements', 'contactattendsmeeting'],
    ]

    dependencies = [
        ('projects', '0028_rename_meeting_permissions'),
    ]

    operations = [
        # migrations.RunPython(forwards_func, reverse_func),
        migrations.RunPython(
            code=lambda *args, **kwargs:
            PermissionMigrationHelper.forwards_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs
            ),
            reverse_code=lambda *args, **kwargs:
            PermissionMigrationHelper.reverse_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs
            )
        ),
    ]
Ejemplo n.º 4
0
class Migration(PermissionContentTypeApplyMigration):
    permissions_to_add = [
        # codename, app, model

        ['change_dmpformdata', 'dmp', 'dmpformdata']
    ]

    dependencies = [
        ('projects', '0017_role_add_pm_permissions'),
        ('dmp', '0007_dmp_form_data_add_ordering'),
    ]

    operations = [
        # migrations.RunPython(forwards_func, reverse_func),
        migrations.RunPython(
            code=lambda *args, **kwargs:
            PermissionMigrationHelper.forwards_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs
            ),
            reverse_code=lambda *args, **kwargs:
            PermissionMigrationHelper.reverse_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs
            )
        ),
    ]
class Migration(migrations.Migration):
    permissions_to_add = [
        # codename, app, model
        ['view_labbook', 'labbooks', 'labbook'],
    ]

    dependencies = [
        ('labbooks', '0003_pm_add_labbook_permissions'),
    ]

    operations = [
        # migrations.RunPython(forwards_func, reverse_func),
        migrations.RunPython(
            code=lambda *args, **kwargs:
            PermissionMigrationHelper.forwards_func_observer(
                Migration.permissions_to_add, *args, **kwargs),
            reverse_code=lambda *args, **kwargs:
            PermissionMigrationHelper.reverse_func_observer(
                Migration.permissions_to_add, *args, **kwargs)),
    ]
class Migration(migrations.Migration):
    permissions_to_add = [
        # codename, app, model
        ['add_project', 'projects', 'project'],
    ]

    dependencies = [
        ('projects', '0050_fix_file_entry_changesets'),
    ]

    operations = [
        # migrations.RunPython(forwards_func, reverse_func),
        migrations.RunPython(
            code=lambda *args, **kwargs:
            PermissionMigrationHelper.forwards_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs),
            reverse_code=lambda *args, **kwargs:
            PermissionMigrationHelper.reverse_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs)),
    ]
Ejemplo n.º 7
0
class Migration(migrations.Migration):
    permissions_to_add = [
        # codename, app, model
        # projects
        ['restore_project', 'projects', 'project'],
        ['trash_project', 'projects', 'project'],
        # tasks
        ['restore_task', ['projects', 'shared_elements'], 'task'],
        ['trash_task', ['projects', 'shared_elements'], 'task'],
        # meetings
        ['restore_meeting', ['projects', 'shared_elements'], 'meeting'],
        ['trash_meeting', ['projects', 'shared_elements'], 'meeting'],
        # contacts
        ['restore_contact', ['projects', 'shared_elements'], 'contact'],
        ['trash_contact', ['projects', 'shared_elements'], 'contact'],
        # notes
        ['restore_note', ['projects', 'shared_elements'], 'note'],
        ['trash_note', ['projects', 'shared_elements'], 'note'],
        # files
        ['restore_file', ['projects', 'shared_elements'], 'file'],
        ['trash_file', ['projects', 'shared_elements'], 'file'],
        # dmps
        ['restore_dmp', 'dmp', 'dmp'],
        ['trash_dmp', 'dmp', 'dmp'],
    ]

    dependencies = [
        ('projects', '0068_permissions_trash_restore'),
    ]

    operations = [
        # migrations.RunPython(forwards_func, reverse_func),
        migrations.RunPython(
            code=lambda *args, **kwargs:
            PermissionMigrationHelper.forwards_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs),
            reverse_code=lambda *args, **kwargs:
            PermissionMigrationHelper.reverse_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs)),
    ]
class Migration(migrations.Migration):
    permissions_to_add = [
        # codename, app, model
        ['change_project_contact', 'shared_elements', 'contact'],
        ['change_project_file', 'shared_elements', 'file'],
        ['change_project_note', 'shared_elements', 'note'],
        ['change_project_meeting', 'shared_elements', 'meeting'],
        ['change_project_task', 'shared_elements', 'task'],
    ]

    dependencies = [
        ('projects', '0062_remove_project_from_entities'),
    ]

    operations = [
        # migrations.RunPython(forwards_func, reverse_func),
        migrations.RunPython(
            code=lambda *args, **kwargs:
            PermissionMigrationHelper.forwards_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs),
            reverse_code=lambda *args, **kwargs:
            PermissionMigrationHelper.reverse_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs)),
    ]
class Migration(migrations.Migration):
    permissions_to_add = [
        # codename, app, model
        ['view_project', 'projects', 'project'],
        ['delete_project', 'projects', 'project'],
        ['change_project', 'projects', 'project'],
        ['change_parent_project', 'projects', 'project'],

        ['add_projectroleuserassignment', 'projects', 'projectroleuserassignment'],
        ['view_projectroleuserassignment', 'projects', 'projectroleuserassignment'],
        ['change_projectroleuserassignment', 'projects', 'projectroleuserassignment'],
        ['delete_projectroleuserassignment', 'projects', 'projectroleuserassignment'],

        ['add_resource', 'projects', 'resource'],
        ['change_resource', 'projects', 'resource'],
        ['delete_resource', 'projects', 'resource'],

        ['view_file', 'shared_elements', 'file'],
        ['add_file', 'shared_elements', 'file'],
        ['change_file', 'shared_elements', 'file'],
        ['delete_file', 'shared_elements', 'file'],
        ['file_change_project', 'shared_elements', 'file'],

        ['view_meeting', 'shared_elements', 'meeting'],
        ['add_meeting', 'shared_elements', 'meeting'],
        ['change_meeting', 'shared_elements', 'meeting'],
        ['delete_meeting', 'shared_elements', 'meeting'],
        ['meeting_change_project', 'shared_elements', 'meeting'],

        ['view_note', 'shared_elements', 'note'],
        ['add_note', 'shared_elements', 'note'],
        ['change_note', 'shared_elements', 'note'],
        ['delete_note', 'shared_elements', 'note'],
        ['note_change_project', 'shared_elements', 'note'],

        ['view_task', 'shared_elements', 'task'],
        ['add_task', 'shared_elements', 'task'],
        ['change_task', 'shared_elements', 'task'],
        ['delete_task', 'shared_elements', 'task'],
        ['task_change_project', 'shared_elements', 'task'],

        ['view_contact', 'shared_elements', 'contact'],
        ['add_contact', 'shared_elements', 'contact'],
        ['change_contact', 'shared_elements', 'contact'],
        ['delete_contact', 'shared_elements', 'contact'],
        ['contact_change_project', 'shared_elements', 'contact']
    ]

    dependencies = [
        ('projects', '0016_role_add_default_roles'),
    ]

    operations = [
        # migrations.RunPython(forwards_func, reverse_func),
        migrations.RunPython(
            code=lambda *args, **kwargs:
            PermissionMigrationHelper.forwards_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs
            ),
            reverse_code=lambda *args, **kwargs:
            PermissionMigrationHelper.reverse_func_project_manager(
                Migration.permissions_to_add, *args, **kwargs
            )
        ),
    ]