File modules/cms/ui/action/IndexAction.class.php

Last commit: Sat Mar 19 00:09:47 2022 +0100	dankert	Refactoring: Outputs are setting their content-type themself.
1 <?php 2 3 namespace cms\ui\action; 4 5 use cms\action\Action; 6 use cms\action\RequestParams; 7 use cms\auth\Auth; 8 use cms\auth\AuthRunner; 9 use cms\base\Configuration; 10 use cms\base\Configuration as C; 11 use cms\base\Startup; 12 use cms\model\BaseObject; 13 use cms\model\Project; 14 use cms\model\User; 15 use cms\model\Value; 16 use cms\ui\themes\Theme; 17 use Exception; 18 use language\Messages; 19 use util\Html; 20 use util\json\JSON; 21 use logger\Logger; 22 use util\Less; 23 use util\UIUtils; 24 use \util\exception\ObjectNotFoundException; 25 use util\Session; 26 27 28 /** 29 * Action-Klasse fuer die Anzeige der Hauptseite. 30 * 31 * @author Jan Dankert 32 * @package openrat.actions 33 */ 34 class IndexAction extends Action 35 { 36 37 /** 38 * Konstruktor 39 */ 40 function __construct() 41 { 42 parent::__construct(); 43 } 44 45 /** 46 * @param User $user 47 * @return \configuration\Config|string 48 */ 49 protected function getUserStyle($user ) 50 { 51 // Theme für den angemeldeten Benutzer ermitteln 52 if ( $user && C::subset('style')->has($user->style) ) 53 $style = $user->style; 54 else 55 $style = C::subset( ['interface', 'style'])->get('default','default'); 56 return $style; 57 } 58 59 60 61 62 /** 63 * Content-Security-Policy. 64 */ 65 protected function addContentSecurityPolicy() 66 { 67 $csp = Configuration::subset('security' )->get('csp', [ 68 'default-src' =>'\'self\'', // Default for all is 'self' (CSS, styles, etc) 69 'frame-src' => '*' // For preview of urls we need to show every url in an iframe. 70 ] ); 71 72 $this->setContentSecurityPolicy( $csp ); 73 } 74 75 76 public function checkAccess() { 77 return true; // Allowed for all 78 } 79 80 }
Download modules/cms/ui/action/IndexAction.class.php
History Sat, 19 Mar 2022 00:09:47 +0100 dankert Refactoring: Outputs are setting their content-type themself. Sun, 14 Mar 2021 22:29:56 +0100 Jan Dankert Refactoring: Clearer access check. Wed, 18 Nov 2020 20:23:57 +0100 Jan Dankert Cleaning up the UI actions. Tue, 17 Nov 2020 23:51:00 +0100 Jan Dankert Refactoring: Every Actionmethod has now its own class. Mon, 16 Nov 2020 13:21:57 +0100 Jan Dankert Code cleanup: Externalize calling the auth modules. Sat, 14 Nov 2020 00:19:16 +0100 Jan Dankert Overwrite the content security policy by configuration setting. Tue, 10 Nov 2020 23:30:07 +0100 Jan Dankert The background image is now configurable by the style configuration. Mon, 9 Nov 2020 22:21:24 +0100 Jan Dankert Fix: The LESS parser must be created for every new loop. Sun, 1 Nov 2020 00:36:50 +0100 Jan Dankert Refactoring: Only using the configuration object. Sat, 31 Oct 2020 00:43:29 +0100 Jan Dankert New: Support for OpenId Connect; Removed: Support for LDAP. Thu, 22 Oct 2020 13:49:13 +0200 Jan Dankert Refactoring: Generating the root HTML with a clean template. Wed, 21 Oct 2020 23:13:01 +0200 Jan Dankert Externalize constants. Wed, 21 Oct 2020 21:31:48 +0200 Jan Dankert Move some UI logic to the action class. Tue, 29 Sep 2020 22:17:11 +0200 Jan Dankert Refactoring: Do not use global constants. Sun, 27 Sep 2020 04:09:05 +0200 Jan Dankert Refactoring: The tree functions should use normal templates as the other actions. Beware of the JS hell. Sat, 26 Sep 2020 23:14:58 +0200 Jan Dankert Fix: Oops, a missing Import. Sat, 26 Sep 2020 21:42:51 +0200 Jan Dankert Refactoring: The UI Actions are now in their own namespace. No need for a confusing require file. Sat, 26 Sep 2020 12:20:43 +0200 Jan Dankert Refactoring: No global variables like $SESS any more. All constants are capsulated by classes. Sat, 26 Sep 2020 10:32:02 +0200 Jan Dankert Refactoring: No global $conf array any more. Sat, 26 Sep 2020 04:26:55 +0200 Jan Dankert Refactoring: read configuration values with a class. Sat, 26 Sep 2020 01:41:20 +0200 Jan Dankert Refactoring: Removing old require.php files. With class autoloading, they are not necessary any more. Thu, 10 Sep 2020 23:49:43 +0200 Jan Dankert Some cleanup. Fri, 21 Aug 2020 00:22:13 +0200 Jan Dankert Refactoring: Collect all frontend compiler scripts in update.php. Compiling of CSS and JS was extracted to a new TemplateCompiler. JS and CSS is now collected in a new openrat.[min.][js|css]. Thu, 9 Apr 2020 21:55:38 +0200 Jan Dankert Fix links to CSS files in development mode. Mon, 24 Feb 2020 22:57:16 +0100 Jan Dankert Fix: Broken paths. Sun, 23 Feb 2020 05:17:22 +0100 Jan Dankert Refactoring with Namespaces for the cms modules, last part 3. Sun, 23 Feb 2020 04:49:34 +0100 Jan Dankert Refactoring with Namespaces for the cms modules, part 2. Sun, 23 Feb 2020 04:01:30 +0100 Jan Dankert Refactoring with Namespaces for the cms modules, part 1: moving.