rename mediafiles private flag to hidden
This commit is contained in:
parent
2bf1b3d827
commit
6bbbf30d94
@ -1012,7 +1012,7 @@ img {
|
||||
}
|
||||
|
||||
.os-table .title {
|
||||
font-size: 115%;
|
||||
font-size: 120%;
|
||||
margin-right: 3px;
|
||||
padding: 0;
|
||||
background-color: transparent;
|
||||
|
@ -24,7 +24,7 @@ class MediafileAccessPermissions(BaseAccessPermissions):
|
||||
Returns the restricted serialized data for the instance prepared
|
||||
for the user.
|
||||
"""
|
||||
if (not full_data['private'] or user.has_perm('mediafiles.can_see_private')):
|
||||
if (not full_data['hidden'] or user.has_perm('mediafiles.can_see_hidden')):
|
||||
data = full_data
|
||||
else:
|
||||
data = None
|
||||
|
31
openslides/mediafiles/migrations/0004_auto_20161212_1612.py
Normal file
31
openslides/mediafiles/migrations/0004_auto_20161212_1612.py
Normal file
@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.4 on 2016-12-12 15:12
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mediafiles', '0003_auto_20160514_1347'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='mediafile',
|
||||
options={
|
||||
'default_permissions': (),
|
||||
'ordering': ['title'],
|
||||
'permissions': (
|
||||
('can_see', 'Can see the list of files'),
|
||||
('can_see_hidden', 'Can see hidden files'),
|
||||
('can_upload', 'Can upload files'),
|
||||
('can_manage', 'Can manage files'))},
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='mediafile',
|
||||
old_name='private',
|
||||
new_name='hidden',
|
||||
),
|
||||
]
|
@ -30,8 +30,8 @@ class Mediafile(RESTModelMixin, models.Model):
|
||||
blank=True)
|
||||
"""A user – the uploader of a file."""
|
||||
|
||||
private = models.BooleanField(default=False)
|
||||
"""Whether or not this mediafile should be listed as private"""
|
||||
hidden = models.BooleanField(default=False)
|
||||
"""Whether or not this mediafile should be marked as hidden"""
|
||||
|
||||
timestamp = models.DateTimeField(auto_now_add=True)
|
||||
"""A DateTimeField to save the upload date and time."""
|
||||
@ -44,7 +44,7 @@ class Mediafile(RESTModelMixin, models.Model):
|
||||
default_permissions = ()
|
||||
permissions = (
|
||||
('can_see', 'Can see the list of files'),
|
||||
('can_see_private', 'Can see private files'),
|
||||
('can_see_hidden', 'Can see hidden files'),
|
||||
('can_upload', 'Can upload files'),
|
||||
('can_manage', 'Can manage files'))
|
||||
|
||||
|
@ -63,7 +63,7 @@ class MediafileSerializer(ModelSerializer):
|
||||
'media_url_prefix',
|
||||
'uploader',
|
||||
'filesize',
|
||||
'private',
|
||||
'hidden',
|
||||
'timestamp',)
|
||||
|
||||
def get_filesize(self, mediafile):
|
||||
|
@ -107,11 +107,11 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
|
||||
|
||||
if (!$scope.filter.existsStorageEntry()) {
|
||||
$scope.filter.booleanFilters = {
|
||||
isPrivate: {
|
||||
isHidden: {
|
||||
value: undefined,
|
||||
displayName: gettext('Private'),
|
||||
choiceYes: gettext('Is private'),
|
||||
choiceNo: gettext('Is not private'),
|
||||
displayName: gettext('Hidden'),
|
||||
choiceYes: gettext('Is hidden'),
|
||||
choiceNo: gettext('Is not hidden'),
|
||||
needExtraPermission: true,
|
||||
},
|
||||
isPdf: {
|
||||
@ -403,7 +403,7 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
|
||||
return Upload.upload({
|
||||
url: '/rest/mediafiles/mediafile/',
|
||||
method: 'POST',
|
||||
data: {mediafile: mediafile.newFile, title: mediafile.title, uploader_id: mediafile.uploader_id, private: mediafile.private}
|
||||
data: {mediafile: mediafile.newFile, title: mediafile.title, uploader_id: mediafile.uploader_id, hidden: mediafile.hidden}
|
||||
});
|
||||
|
||||
}
|
||||
@ -411,16 +411,16 @@ angular.module('OpenSlidesApp.mediafiles.site', ['ngFileUpload', 'OpenSlidesApp.
|
||||
}
|
||||
])
|
||||
|
||||
.filter('privateFilter', [
|
||||
.filter('hiddenFilter', [
|
||||
'$filter',
|
||||
'operator',
|
||||
function ($filter, operator) {
|
||||
return function (array) {
|
||||
if (operator.hasPerms('mediafiles.can_see_private')) {
|
||||
if (operator.hasPerms('mediafiles.can_see_hidden')) {
|
||||
return array;
|
||||
}
|
||||
return Array.prototype.filter.call(array, function (item) {
|
||||
return !item.private;
|
||||
return !item.hidden;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -21,12 +21,15 @@
|
||||
<input type="text" ng-model="mediafile.title" class="form-control" name="inputTitle">
|
||||
</div>
|
||||
|
||||
<!-- private -->
|
||||
<div class="checkbox" os-perms="mediafiles.can_see_private">
|
||||
<label for="inputPrivate">
|
||||
<input type="checkbox" ng-model="mediafile.private" name="inputPrivate">
|
||||
<translate>Private</translate>
|
||||
<!-- hidden -->
|
||||
<div class="checkbox" os-perms="mediafiles.can_see_hidden">
|
||||
<label>
|
||||
<input class="formly-field-chackbox" type="checkbox" ng-model="mediafile.hidden" name="inputHidden">
|
||||
<translate>Hidden</translate>
|
||||
</label>
|
||||
<p class="help-block" translate>
|
||||
This does not protect the file but hides it for non authorized users.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!-- uploader -->
|
||||
|
@ -161,7 +161,7 @@
|
||||
</span>
|
||||
<!-- boolean Filters -->
|
||||
<span ng-repeat="(name, booleanFilter) in filter.booleanFilters"
|
||||
ng-if="!booleanFilter.needExtraPermission || operator.hasPerms('mediafiles.can_see_private')" uib-dropdown>
|
||||
ng-if="!booleanFilter.needExtraPermission || operator.hasPerms('mediafiles.can_see_hidden')" uib-dropdown>
|
||||
<span class="pointer" id="dropdown{{ name }}" uib-dropdown-toggle
|
||||
ng-class="{'bold': booleanFilter.value !== undefined, 'disabled': isSelectMode}"
|
||||
ng-disabled="isSelectMode">
|
||||
@ -236,10 +236,10 @@
|
||||
ng-mouseleave="mediafile.hover=false"
|
||||
ng-class="{'projected': mediafile.isProjected().length}"
|
||||
ng-repeat="mediafile in mediafilesFiltered = (mediafiles
|
||||
| privateFilter
|
||||
| hiddenFilter
|
||||
| osFilter: filter.filterString : filter.getObjectQueryString
|
||||
| filter: {filetype: (filter.booleanFilters.isPdf.value ? 'application/pdf' : (filter.booleanFilters.isPdf.value === false ? '!application/pdf' : ''))}
|
||||
| filter: {private: filter.booleanFilters.isPrivate.value}
|
||||
| filter: {hidden: filter.booleanFilters.isHidden.value}
|
||||
| orderBy: sort.column : sort.reverse )">
|
||||
|
||||
<!-- select column -->
|
||||
@ -279,8 +279,8 @@
|
||||
<!-- main content column -->
|
||||
<div class="col-xs-6 content">
|
||||
<div class="spacer-right"> <!-- horizontal block -->
|
||||
<i ng-style="{'visibility': mediafile.private ? 'visible' : 'hidden'}" class="fa fa-lock fa-lg"
|
||||
title="{{ 'Is private' | translate }}"></i>
|
||||
<i ng-style="{'visibility': mediafile.hidden ? 'visible' : 'hidden'}" class="fa fa-lock fa-lg"
|
||||
title="{{ 'Is hidden' | translate }}"></i>
|
||||
</div>
|
||||
<div>
|
||||
<div> <!-- vertical block -->
|
||||
|
@ -33,7 +33,7 @@ def create_builtin_groups_and_admin(**kwargs):
|
||||
'core.can_use_chat',
|
||||
'mediafiles.can_manage',
|
||||
'mediafiles.can_see',
|
||||
'mediafiles.can_see_private',
|
||||
'mediafiles.can_see_hidden',
|
||||
'mediafiles.can_upload',
|
||||
'motions.can_create',
|
||||
'motions.can_manage',
|
||||
@ -114,7 +114,7 @@ def create_builtin_groups_and_admin(**kwargs):
|
||||
permission_dict['users.can_see_name'],
|
||||
permission_dict['users.can_manage'],
|
||||
permission_dict['users.can_see_extra_data'],
|
||||
permission_dict['mediafiles.can_see_private'],)
|
||||
permission_dict['mediafiles.can_see_hidden'],)
|
||||
group_staff = Group.objects.create(name='Staff', pk=3)
|
||||
group_staff.permissions.add(*staff_permissions)
|
||||
|
||||
|
@ -1541,7 +1541,7 @@ angular.module('OpenSlidesApp.users.site', [
|
||||
gettext('Can see the list of files');
|
||||
gettext('Can upload files');
|
||||
gettext('Can manage files');
|
||||
gettext('Can see private files');
|
||||
gettext('Can see hidden files');
|
||||
// motions
|
||||
gettext('Can see motions');
|
||||
gettext('Can create motions');
|
||||
|
Loading…
Reference in New Issue
Block a user