commit 5786d589b8030126639c4906591080f1ad01cb32
parent fba79c326f8f4e31bb9a53b4bf10551f65fd5b62
Author: Jan Dankert <develop@jandankert.de>
Date: Sat, 6 Mar 2021 02:31:06 +0100
Fix: Inheriting rights was missing.
Diffstat:
5 files changed, 42 insertions(+), 30 deletions(-)
diff --git a/modules/cms/model/BaseObject.class.php b/modules/cms/model/BaseObject.class.php
@@ -270,17 +270,17 @@ class BaseObject extends ModelBase
{
if ( is_null($this->aclMask) )
{
- $user = \util\Session::getUser();
+ $user = \util\Session::getUser();
+ $this->aclMask = 0;
- if ( ! $user ) {
+ if ( ! $user ) {
// Anonymous
- $this->aclMask = 0;
$sql = Db::sql( <<<SQL
- SELECT {{acl}}.* FROM {{acl}}
- WHERE objectid={objectid}
- AND {{acl}}.type = {guest}
+ SELECT * FROM {{acl}}
+ WHERE objectid={objectid}
+ AND type = {guest}
SQL
);
@@ -297,30 +297,38 @@ SQL
}
- elseif ( $user->isAdmin )
+ elseif ( $user->isAdmin )
{
- // Administratoren erhalten eine Maske mit allen Rechten
+ // Administrators got all rights
$this->aclMask = Permission::ACL_ALL;
}
else
{
+ // Normal user
$this->aclMask = 0;
$sqlGroupClause = $user->getGroupClause();
$sql = Db::sql( <<<SQL
-SELECT {{acl}}.* FROM {{acl}}
+ SELECT * FROM {{acl}}
WHERE objectid={objectid}
AND ( languageid={languageid} OR languageid IS NULL )
- AND ( {{acl}}.userid={userid} OR $sqlGroupClause
- OR ({{acl}}.userid IS NULL AND {{acl}}.groupid IS NULL) )
+ AND ( type = {user} AND userid={userid}
+ OR type = {group} AND $sqlGroupClause
+ OR type = {all}
+ OR type = {guest}
+ )
SQL
);
$sql->setInt ( 'languageid' ,$this->languageid );
$sql->setInt ( 'objectid' ,$this->objectid );
$sql->setInt ( 'userid' ,$user->userid );
+ $sql->setInt ( 'user' ,Permission::TYPE_USER );
+ $sql->setInt ( 'group' ,Permission::TYPE_GROUP);
+ $sql->setInt ( 'all' ,Permission::TYPE_AUTH );
+ $sql->setInt ( 'guest' ,Permission::TYPE_GUEST );
- foreach($sql->getAll() as $row )
+ foreach($sql->getAll() as $row )
{
$permission = new Permission();
$permission->setDatabaseRow( $row );
diff --git a/modules/cms/ui/themes/default/html/views/object/inherit.php b/modules/cms/ui/themes/default/html/views/object/inherit.php
@@ -15,17 +15,14 @@
</h2>
<div class="<?php echo O::escapeHtml('or-collapsible-value or-group-value') ?>"><?php echo O::escapeHtml('') ?>
<section class="<?php echo O::escapeHtml('or-fieldset') ?>"><?php echo O::escapeHtml('') ?>
- <h3 class="<?php echo O::escapeHtml('or-fieldset-label') ?>"><?php echo O::escapeHtml('') ?></h3>
+ <h3 class="<?php echo O::escapeHtml('or-fieldset-label') ?>"><?php echo O::escapeHtml(''.@O::lang('acl_transmit').'') ?></h3>
<div class="<?php echo O::escapeHtml('or-fieldset-value') ?>"><?php echo O::escapeHtml('') ?>
- <div class="<?php echo O::escapeHtml('or-label') ?>"><?php echo O::escapeHtml('') ?></div>
- <div class="<?php echo O::escapeHtml('or-value') ?>"><?php echo O::escapeHtml('') ?>
- <?php { $inherit= 1; ?>
- <?php } ?>
+ <?php { $inherit= 1; ?>
+ <?php } ?>
+ <label><?php echo O::escapeHtml('') ?>
<input type="<?php echo O::escapeHtml('checkbox') ?>" name="<?php echo O::escapeHtml('inherit') ?>" value="<?php echo O::escapeHtml('1') ?>" <?php if(@$inherit){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-checkbox') ?>" /><?php echo O::escapeHtml('') ?>
- <label class="<?php echo O::escapeHtml('or-label') ?>"><?php echo O::escapeHtml('') ?>
- <span><?php echo O::escapeHtml(''.@O::lang('inherit_rights').'') ?></span>
- </label>
- </div>
+ <span class="<?php echo O::escapeHtml('or-form-label') ?>"><?php echo O::escapeHtml(''.@O::lang('inherit_rights').'') ?></span>
+ </label>
</div>
</section>
</div>
diff --git a/modules/cms/ui/themes/default/html/views/object/inherit.tpl.src.xml b/modules/cms/ui/themes/default/html/views/object/inherit.tpl.src.xml
@@ -3,16 +3,9 @@
<form>
<if value="${type}" equals="folder">
<group title="${message:options}">
- <fieldset class="line" label="">
- <part class="label">
- </part>
- <part class="value">
+ <fieldset label="${message:acl_transmit}">
<set var="inherit" value="1"/>
- <checkbox name="inherit"/>
- <label for="inherit">
- <text value="${message:inherit_rights}"/>
- </label>
- </part>
+ <checkbox name="inherit" label="${message:inherit_rights}"/>
</fieldset>
</group>
</if>
diff --git a/modules/cms/ui/themes/default/html/views/object/rights.php b/modules/cms/ui/themes/default/html/views/object/rights.php
@@ -77,4 +77,10 @@
</tr>
</table>
</div>
+ </div>
+ <div class="<?php echo O::escapeHtml('or-act-clickable') ?>"><?php echo O::escapeHtml('') ?>
+ <a target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('dialog') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('inherit') ?>" data-id="<?php echo O::escapeHtml('') ?>" data-extra-dialogAction="<?php echo O::escapeHtml('') ?>" data-extra-dialogMethod="<?php echo O::escapeHtml('inherit') ?>" data-extra="<?php echo O::escapeHtml('{\'dialogAction\':null,\'dialogMethod\':\'inherit\'}') ?>" href="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-link or-btn') ?>"><?php echo O::escapeHtml('') ?>
+ <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--method-rights') ?>"><?php echo O::escapeHtml('') ?></i>
+ <span><?php echo O::escapeHtml(''.@O::lang('ACL_TRANSMIT').'') ?></span>
+ </a>
</div>
\ No newline at end of file
diff --git a/modules/cms/ui/themes/default/html/views/object/rights.tpl.src.xml b/modules/cms/ui/themes/default/html/views/object/rights.tpl.src.xml
@@ -70,4 +70,12 @@
</column>
</row>
</table>
+
+ <part class="act-clickable">
+ <link type="dialog" subaction="inherit" class="btn">
+ <image method="rights"/>
+ <text value="${message:ACL_TRANSMIT}"/>
+ </link>
+ </part>
+
</output>