Commit 5c848d7e authored by Tino Goratsch's avatar Tino Goratsch

- reenabled the permissions calculation

- eliminated some duplicated code in the Permissions::Index controller
parent f1e446a3
......@@ -14,6 +14,7 @@
<item key="allow_access">Erlaubt</item>
<item key="area">Bereich</item>
<item key="assigned_privilege">Zugeordnetes Privileg</item>
<item key="calculated_permission">Berechnet: %s</item>
<item key="controller">Controller</item>
<item key="filename">Dateiname</item>
<item key="deny_access">Verweigert</item>
......
......@@ -14,6 +14,7 @@
<item key="allow_access">Allow</item>
<item key="area">Area</item>
<item key="assigned_privilege">Assigned privilege</item>
<item key="calculated_permission">Calculated: %s</item>
<item key="controller">Controller</item>
<item key="filename">Filename</item>
<item key="deny_access">Deny</item>
......
......@@ -97,7 +97,7 @@ class Model extends Core\Model
public function getAllRulesByRoleIds(array $roles)
{
return $this->db->getConnection()->executeQuery(
'SELECT ru.role_id, ru.privilege_id, ru.permission, ru.module_id, m.name AS module_name, p.key, p.description FROM ' . $this->getTableName(static::TABLE_NAME_RULES) . ' AS ru JOIN ' . $this->getTableName(\ACP3\Modules\ACP3\System\Model::TABLE_NAME) . ' AS m ON (ru.module_id = m.id) JOIN ' . $this->getTableName(static::TABLE_NAME_PRIVILEGES) . ' AS p ON(ru.privilege_id = p.id) WHERE m.active = 1 AND ru.role_id IN(?)',
'SELECT ru.role_id, ru.privilege_id, ru.permission, ru.module_id, m.name AS module_name, p.key, p.description FROM ' . $this->getTableName(static::TABLE_NAME_RULES) . ' AS ru JOIN ' . $this->getTableName(\ACP3\Modules\ACP3\System\Model::TABLE_NAME) . ' AS m ON (ru.module_id = m.id) JOIN ' . $this->getTableName(static::TABLE_NAME_PRIVILEGES) . " AS p ON(ru.privilege_id = p.id) JOIN {$this->getTableName()} AS ro ON(ro.id = ru.role_id) WHERE m.active = 1 AND ro.id IN(?)",
[$roles],
[\Doctrine\DBAL\Connection::PARAM_INT_ARRAY]
)->fetchAll();
......
......@@ -50,6 +50,9 @@
<label for="privileges-{$values.id}-{$privilege.id}-{$row.value}" class="btn btn-default{if !empty($row.selected)} active{/if}">
<input type="radio" name="privileges[{$values.id}][{$privilege.id}]" id="privileges-{$values.id}-{$privilege.id}-{$row.value}" value="{$row.value}"{$row.selected}>
{$row.lang}
{if $row.value === 2 && isset($privilege.calculated)}
<small>({$privilege.calculated})</small>
{/if}
</label>
{/foreach}
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment