make the privacy policy available for non logged in users (closes #3757)

This commit is contained in:
FinnStutzenstein 2018-06-22 14:39:29 +02:00
parent 4007610a54
commit 26d168110f
6 changed files with 41 additions and 1 deletions

3
.gitignore vendored
View File

@ -35,3 +35,6 @@ openslides_*
# Mypy cache for typechecking
.mypy_cache
# Development of a new client. Easier to switch branches with this entry
client/*

View File

@ -115,7 +115,13 @@ class CoreAppConfig(AppConfig):
'name': 'OpenSlidesConfigVariables',
'value': config_groups}
return [client_settings, config_variables]
# Send the privacy policy to the client. A user should view them, even he is
# not logged in (so does not have the config values yet).
privacy_policy = {
'name': 'PrivacyPolicy',
'value': config['general_event_privacy_policy']}
return [client_settings, config_variables, privacy_policy]
def call_save_default_values(**kwargs):

View File

@ -25,5 +25,6 @@
</button>
<template-hook hook-name="loginFormButtons"></template-hook>
</div>
<a href="" ng-click="openPrivacyPolicyDialog()" translate>Privacy policy</a>
</div>
</form>

View File

@ -0,0 +1,9 @@
<h1 translate>Privacy policy</h1>
<div ng-if="privacyPolicy" ng-bind-html="privacyPolicy | translate"></div>
<div ng-if="!privacyPolicy" translate>
The event manager hasn't set up a privacy policy yet.
</div>
<button ng-click="closeThisDialog()" class="btn btn-default spacer-top" translate>
Close
</button>

View File

@ -1778,6 +1778,26 @@ angular.module('OpenSlidesApp.users.site', [
$scope.closeThisDialog();
$state.go('home');
};
// quick fix, that we cannot change the state to the main privacy
// policy view. Display it in a dialog..
$scope.openPrivacyPolicyDialog = function () {
ngDialog.open({
template: 'static/templates/privacypolicydialog.html',
className: 'ngdialog-theme-default wide-form',
controller: 'PrivacyPolicyDialogCtrl',
showClose: true,
closeByEscape: true,
closeByDocument: true,
});
};
}
])
.controller('PrivacyPolicyDialogCtrl', [
'$scope',
'PrivacyPolicy',
function ($scope, PrivacyPolicy) {
$scope.privacyPolicy = PrivacyPolicy;
}
])

View File

@ -173,6 +173,7 @@ class WebclientJavaScriptView(TestCase):
@patch('openslides.core.config.config')
@patch('django.contrib.auth.models.Permission.objects.all')
def test_permissions_as_constant(self, mock_permissions_all, mock_config):
mock_config.__getitem__.return_value = ''
self.view_instance = views.WebclientJavaScriptView()
self.view_instance.request = self.request
response = self.view_instance.get(realm='site')