commit f5c12f65695c9b1b529cd8ffafbafbf9b7ef1e52
parent 9398dd9f8c1e3dc6e904f27e03c277a111c04925
Author: Jan Dankert <devnull@localhost>
Date: Sat, 8 Sep 2018 23:23:28 +0200
Neuanlage neues Projekt funktioniert jetzt. Objekte müssen bei der Anlage einen leeren Default-Wert für Settings bekommen.
Diffstat:
4 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/modules/cms-core/action/ProjectlistAction.class.php b/modules/cms-core/action/ProjectlistAction.class.php
@@ -2,6 +2,7 @@
namespace cms\action;
+use cms\model\Folder;
use cms\model\Project;
// OpenRat Content Management System
@@ -30,7 +31,7 @@ use cms\model\Project;
*/
class ProjectlistAction extends Action
{
- public $security = SECURITY_ADMIN;
+ public $security = SECURITY_USER;
function __construct()
{
@@ -49,11 +50,25 @@ class ProjectlistAction extends Action
foreach(Project::getAllProjects() as $id=> $name )
{
- $list[$id] = array();
- $list[$id]['id' ] = $id;
- $list[$id]['name' ] = $name;
- }
+
+ // Schleife ueber alle Projekte
+ foreach (Project::getAllProjects() as $id => $name) {
+
+ $project = new Project($id);
+ $rootFolder = new Folder($project->getRootObjectId());
+ $rootFolder->load();
+
+ // Berechtigt für das Projekt?
+ if ($rootFolder->hasRight(ACL_READ)) {
+ $list[$id] = array();
+ $list[$id]['id' ] = $id;
+ $list[$id]['name' ] = $name;
+ }
+ }
+ }
+
$this->setTemplateVar('projects',$list);
+ $this->setTemplateVar('add',$this->userIsAdmin());
}
@@ -70,6 +85,9 @@ class ProjectlistAction extends Action
*/
function addPost()
{
+ if( !$this->userIsAdmin())
+ throw new \SecurityException("user is not allowed to add a project");
+
if ( !$this->hasRequestVar('type') )
{
$this->addValidationError('type');
diff --git a/modules/cms-core/model/BaseObject.class.php b/modules/cms-core/model/BaseObject.class.php
@@ -872,8 +872,8 @@ SQL
$this->checkFilename();
$sql = $db->sql('INSERT INTO {{object}}'.
- ' (id,parentid,projectid,filename,orderid,create_date,create_userid,lastchange_date,lastchange_userid,typeid)'.
- ' VALUES( {objectid},{parentid},{projectid},{filename},{orderid},{time},{createuserid},{createtime},{userid},{typeid} )');
+ ' (id,parentid,projectid,filename,orderid,create_date,create_userid,lastchange_date,lastchange_userid,typeid,settings)'.
+ ' VALUES( {objectid},{parentid},{projectid},{filename},{orderid},{time},{createuserid},{createtime},{userid},{typeid},\'\' )');
if ( $this->isRoot )
$sql->setNull('parentid');
diff --git a/modules/cms-ui/themes/default/html/views/title/show.php b/modules/cms-ui/themes/default/html/views/title/show.php
@@ -29,7 +29,7 @@
<div class="arrow-down">
</div>
<div class="dropdown">
- <div class="entry clickable filtered on-action-folder on-action-page on-action-file">
+ <div class="entry clickable filtered on-action-folder on-action-page on-action-file on-action-projectlist on-action-templatelist">
<a title="<?php echo lang('menu_new_desc') ?>" target="_self" data-type="dialog" data-action="" data-method="new" data-id="<?php echo OR_ID ?>" data-extra="{'dialogAction':null,'dialogMethod':'new'}" href="<?php echo Html::url('','new','',array('dialogAction'=>'','dialogMethod'=>'new')) ?>">
<img class="image-icon image-icon--method" title="" src="./modules/cms-ui/themes/default/images/icon/method/add.svg" />
diff --git a/modules/cms-ui/themes/default/html/views/title/show.tpl.src.xml b/modules/cms-ui/themes/default/html/views/title/show.tpl.src.xml
@@ -30,7 +30,7 @@
<part class="arrow-down"/>
<part class="dropdown">
<part
- class="entry clickable filtered on-action-folder on-action-page on-action-file">
+ class="entry clickable filtered on-action-folder on-action-page on-action-file on-action-projectlist on-action-templatelist">
<link type="dialog" title="message:menu_new_desc" subaction="new">
<image method="add" align="left"></image>
<text key="menu_new"></text>