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 for typechecking
.mypy_cache .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', 'name': 'OpenSlidesConfigVariables',
'value': config_groups} '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): def call_save_default_values(**kwargs):

View File

@ -25,5 +25,6 @@
</button> </button>
<template-hook hook-name="loginFormButtons"></template-hook> <template-hook hook-name="loginFormButtons"></template-hook>
</div> </div>
<a href="" ng-click="openPrivacyPolicyDialog()" translate>Privacy policy</a>
</div> </div>
</form> </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(); $scope.closeThisDialog();
$state.go('home'); $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('openslides.core.config.config')
@patch('django.contrib.auth.models.Permission.objects.all') @patch('django.contrib.auth.models.Permission.objects.all')
def test_permissions_as_constant(self, mock_permissions_all, mock_config): def test_permissions_as_constant(self, mock_permissions_all, mock_config):
mock_config.__getitem__.return_value = ''
self.view_instance = views.WebclientJavaScriptView() self.view_instance = views.WebclientJavaScriptView()
self.view_instance.request = self.request self.view_instance.request = self.request
response = self.view_instance.get(realm='site') response = self.view_instance.get(realm='site')