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