/** * Showing the permissions in a tree ($this->edit = false) * (Adding content to internal content variable) * * @return void */ public function notEdit() { global $BE_USER, $LANG, $BACK_PATH; // Get usernames and groupnames: The arrays we get in return contains only 1) users which are members of the groups of the current user, 2) groups that the current user is member of $beGroupKeys = $BE_USER->userGroupsUID; $beUserArray = t3lib_BEfunc::getUserNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beUserArray = t3lib_BEfunc::blindUserNames($beUserArray, $beGroupKeys, 0); } $beGroupArray = t3lib_BEfunc::getGroupNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beGroupArray = t3lib_BEfunc::blindGroupNames($beGroupArray, $beGroupKeys, 0); } // Length of strings: $tLen = $this->MOD_SETTINGS['mode'] == 'perms' ? 20 : 30; // Selector for depth: $code .= $LANG->getLL('Depth') . ': '; $code .= t3lib_BEfunc::getFuncMenu($this->id, 'SET[depth]', $this->MOD_SETTINGS['depth'], $this->MOD_MENU['depth']); $this->content .= $this->doc->section('', $code); $this->content .= $this->doc->spacer(5); // Initialize tree object: $tree = t3lib_div::makeInstance('t3lib_pageTree'); $tree->init('AND ' . $this->perms_clause); $tree->addField('perms_user', 1); $tree->addField('perms_group', 1); $tree->addField('perms_everybody', 1); $tree->addField('perms_userid', 1); $tree->addField('perms_groupid', 1); $tree->addField('hidden'); $tree->addField('fe_group'); $tree->addField('starttime'); $tree->addField('endtime'); $tree->addField('editlock'); // Creating top icon; the current page $HTML = t3lib_iconWorks::getSpriteIconForRecord('pages', $this->pageinfo); $tree->tree[] = array('row' => $this->pageinfo, 'HTML' => $HTML); // Create the tree from $this->id: $tree->getTree($this->id, $this->MOD_SETTINGS['depth'], ''); // Make header of table: $code = ''; if ($this->MOD_SETTINGS['mode'] == 'perms') { $code .= ' <tr class="t3-row-header"> <td colspan="2"> </td> <td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td> <td>' . $LANG->getLL('Owner', TRUE) . '</td> <td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td> <td align="center">' . $LANG->getLL('Group', TRUE) . '</td> <td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td> <td align="center">' . $LANG->getLL('Everybody', TRUE) . '</td> <td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td> <td align="center">' . $LANG->getLL('EditLock', TRUE) . '</td> </tr> '; } else { $code .= ' <tr class="t3-row-header"> <td colspan="2"> </td> <td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td> <td align="center" nowrap="nowrap">' . $LANG->getLL('User', TRUE) . ': ' . htmlspecialchars($BE_USER->user['username']) . '</td> ' . (!$BE_USER->isAdmin() ? '<td><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td> <td align="center">' . $LANG->getLL('EditLock', TRUE) . '</td>' : '') . ' </tr>'; } // Traverse tree: foreach ($tree->tree as $data) { $cells = array(); $pageId = $data['row']['uid']; // Background colors: $bgCol = $this->lastEdited == $pageId ? ' class="bgColor-20"' : ''; $lE_bgCol = $bgCol; // User/Group names: $userName = $beUserArray[$data['row']['perms_userid']] ? $beUserArray[$data['row']['perms_userid']]['username'] : ($data['row']['perms_userid'] ? $data['row']['perms_userid'] : ''); if ($data['row']['perms_userid'] && !$beUserArray[$data['row']['perms_userid']]) { $userName = SC_mod_web_perm_ajax::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($userName, 20)), false); } else { $userName = SC_mod_web_perm_ajax::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($userName, 20))); } $groupName = $beGroupArray[$data['row']['perms_groupid']] ? $beGroupArray[$data['row']['perms_groupid']]['title'] : ($data['row']['perms_groupid'] ? $data['row']['perms_groupid'] : ''); if ($data['row']['perms_groupid'] && !$beGroupArray[$data['row']['perms_groupid']]) { $groupName = SC_mod_web_perm_ajax::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($groupName, 20)), false); } else { $groupName = SC_mod_web_perm_ajax::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(t3lib_div::fixed_lgd_cs($groupName, 20))); } // Seeing if editing of permissions are allowed for that page: $editPermsAllowed = $data['row']['perms_userid'] == $BE_USER->user['uid'] || $BE_USER->isAdmin(); // First column: $cellAttrib = $data['row']['_CSSCLASS'] ? ' class="' . $data['row']['_CSSCLASS'] . '"' : ''; $cells[] = ' <td align="left" nowrap="nowrap"' . ($cellAttrib ? $cellAttrib : $bgCol) . '>' . $data['HTML'] . htmlspecialchars(t3lib_div::fixed_lgd_cs($data['row']['title'], $tLen)) . ' </td>'; // "Edit permissions" -icon if ($editPermsAllowed && $pageId) { $aHref = 'index.php?mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . ($data['row']['_ORIG_uid'] ? $data['row']['_ORIG_uid'] : $pageId) . '&return_id=' . $this->id . '&edit=1'; $cells[] = ' <td' . $bgCol . '><a href="' . htmlspecialchars($aHref) . '" title="' . $LANG->getLL('ch_permissions', 1) . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-open') . '</a></td>'; } else { $cells[] = ' <td' . $bgCol . '></td>'; } // Rest of columns (depending on mode) if ($this->MOD_SETTINGS['mode'] == 'perms') { $cells[] = ' <td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td> <td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_user'], $pageId, 'user') . ' ' . $userName : '') . '</td> <td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td> <td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_group'], $pageId, 'group') . ' ' . $groupName : '') . '</td> <td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td> <td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? ' ' . SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_everybody'], $pageId, 'everybody') : '') . '</td> <td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td> <td' . $bgCol . ' nowrap="nowrap">' . ($data['row']['editlock'] ? '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'1\');" title="' . $LANG->getLL('EditLock_descr', 1) . '">' . t3lib_iconWorks::getSpriteIcon('status-warning-lock') . '</a></span>' : ($pageId === 0 ? '' : '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'0\');" title="Enable the »Admin-only« edit lock for this page">[+]</a></span>')) . '</td> '; } else { $cells[] = ' <td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td>'; $bgCol = $BE_USER->user['uid'] == $data['row']['perms_userid'] ? ' class="bgColor-20"' : $lE_bgCol; // FIXME $owner undefined $cells[] = ' <td' . $bgCol . ' nowrap="nowrap" align="center">' . ($pageId ? $owner . SC_mod_web_perm_ajax::renderPermissions($BE_USER->calcPerms($data['row']), $pageId, 'user') : '') . '</td> ' . (!$BE_USER->isAdmin() ? ' <td' . $bgCol . ' class="center"><img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/line.gif', 'width="5" height="16"') . ' alt="" /></td> <td' . $bgCol . ' nowrap="nowrap">' . ($data['row']['editlock'] ? t3lib_iconWorks::getSpriteIcon('status-warning-lock', array('title' => $LANG->getLL('EditLock_descr', TRUE))) : '') . '</td> ' : ''); $bgCol = $lE_bgCol; } // Compile table row: $code .= ' <tr> ' . implode(' ', $cells) . ' </tr>'; } // Wrap rows in table tags: $code = '<table border="0" cellspacing="0" cellpadding="0" id="typo3-permissionList">' . $code . '</table>'; // Adding the content as a section: $this->content .= $this->doc->section('', $code); // CSH for permissions setting $this->content .= t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'perm_module', $GLOBALS['BACK_PATH'], '<br />|'); // Creating legend table: $legendText = '<strong>' . $LANG->getLL('1', 1) . '</strong>: ' . $LANG->getLL('1_t', 1); $legendText .= '<br /><strong>' . $LANG->getLL('16', 1) . '</strong>: ' . $LANG->getLL('16_t', 1); $legendText .= '<br /><strong>' . $LANG->getLL('2', 1) . '</strong>: ' . $LANG->getLL('2_t', 1); $legendText .= '<br /><strong>' . $LANG->getLL('4', 1) . '</strong>: ' . $LANG->getLL('4_t', 1); $legendText .= '<br /><strong>' . $LANG->getLL('8', 1) . '</strong>: ' . $LANG->getLL('8_t', 1); $code = '<table border="0" id="typo3-legendTable"> <tr> <td valign="top"> <img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/legend.gif', 'width="86" height="75"') . ' alt="" /> </td> <td valign="top" nowrap="nowrap">' . $legendText . '</td> </tr> </table>'; $code .= '<div id="perm-legend">' . $LANG->getLL('def', 1); $code .= '<br /><br />' . t3lib_iconWorks::getSpriteIcon('status-status-permission-granted') . ': ' . $LANG->getLL('A_Granted', 1); $code .= '<br />' . t3lib_iconWorks::getSpriteIcon('status-status-permission-denied') . ': ' . $LANG->getLL('A_Denied', 1); $code .= '</div>'; // Adding section with legend code: $this->content .= $this->doc->spacer(20); $this->content .= $this->doc->section($LANG->getLL('Legend') . ':', $code, 0, 1); }
/** * Showing the permissions in a tree ($this->edit = false) * (Adding content to internal content variable) * * @return void */ public function notEdit() { // Get ACL configuration $beAclConfig = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['be_acl']); $disableOldPermissionSystem = 0; if ($beAclConfig['disableOldPermissionSystem']) { $disableOldPermissionSystem = 1; } $GLOBALS['LANG']->includeLLFile('EXT:be_acl/res/locallang_perm.xml'); // Get usernames and groupnames: The arrays we get in return contains only 1) users which are members of the groups of the current user, 2) groups that the current user is member of $beGroupKeys = $GLOBALS['BE_USER']->userGroupsUID; $beUserArray = BackendUtility::getUserNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beUserArray = BackendUtility::blindUserNames($beUserArray, $beGroupKeys, 0); } $beGroupArray = BackendUtility::getGroupNames(); if (!$GLOBALS['BE_USER']->isAdmin()) { $beGroupArray = BackendUtility::blindGroupNames($beGroupArray, $beGroupKeys, 0); } // Length of strings: $tLen = 20; // Selector for depth: $code = $GLOBALS['LANG']->getLL('Depth') . ': '; $code .= BackendUtility::getFuncMenu($this->id, 'SET[depth]', $this->MOD_SETTINGS['depth'], $this->MOD_MENU['depth']); $this->content .= $this->doc->section('', $code); /** @var \TYPO3\CMS\Backend\Tree\View\PageTreeView */ $tree = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView'); $tree->init('AND ' . $this->perms_clause); $tree->addField('perms_user', 1); $tree->addField('perms_group', 1); $tree->addField('perms_everybody', 1); $tree->addField('perms_userid', 1); $tree->addField('perms_groupid', 1); $tree->addField('hidden'); $tree->addField('fe_group'); $tree->addField('starttime'); $tree->addField('endtime'); $tree->addField('editlock'); // Creating top icon; the current page $HTML = IconUtility::getSpriteIconForRecord('pages', $this->pageinfo); $tree->tree[] = array('row' => $this->pageinfo, 'HTML' => $HTML); // Create the tree from $this->id: $tree->getTree($this->id, $this->MOD_SETTINGS['depth'], ''); // Get list of ACL users and groups, and initialize ACLs $aclUsers = $this->acl_objectSelector(0, $displayUserSelector, $beAclConfig); $aclGroups = $this->acl_objectSelector(1, $displayGroupSelector, $beAclConfig); $this->buildACLtree($aclUsers, $aclGroups); $this->content .= $displayUserSelector; $this->content .= $displayGroupSelector; // Make header of table: $code = ' <thead> <tr> <th colspan="2"> </th> <th>' . $GLOBALS['LANG']->getLL('Owner', TRUE) . '</th>'; $tableCells = array(); if (!$disableOldPermissionSystem) { $tableCells[] = $GLOBALS['LANG']->getLL('Group', TRUE); $tableCells[] = $GLOBALS['LANG']->getLL('Everybody', TRUE); $tableCells[] = $GLOBALS['LANG']->getLL('EditLock', TRUE); } // ACL headers if (!empty($aclUsers)) { $tableCells[] = '<b>' . $GLOBALS['LANG']->getLL('aclUser') . '</b>'; foreach ($aclUsers as $uid) { $tableCells[] = $beUserArray[$uid]['username']; } } if (!empty($aclGroups)) { $tableCells[] = '<b>' . $GLOBALS['LANG']->getLL('aclGroup') . '</b>'; foreach ($aclGroups as $uid) { $tableCells[] = $beGroupArray[$uid]['title']; } } $code .= $this->printTableHeader($tableCells); $code .= ' </tr> </thead>'; // Traverse tree: foreach ($tree->tree as $data) { $cells = array(); $pageId = $data['row']['uid']; // Background colors: $bgCol = $this->lastEdited == $pageId ? ' class="bgColor-20"' : ''; $lE_bgCol = $bgCol; // User/Group names: $userName = $beUserArray[$data['row']['perms_userid']] ? $beUserArray[$data['row']['perms_userid']]['username'] : ($data['row']['perms_userid'] ? $data['row']['perms_userid'] : ''); if ($data['row']['perms_userid'] && !$beUserArray[$data['row']['perms_userid']]) { $userName = SC_mod_web_perm_ajax::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(GeneralUtility::fixed_lgd_cs($userName, 20)), FALSE); } else { $userName = SC_mod_web_perm_ajax::renderOwnername($pageId, $data['row']['perms_userid'], htmlspecialchars(GeneralUtility::fixed_lgd_cs($userName, 20))); } $groupName = $beGroupArray[$data['row']['perms_groupid']] ? $beGroupArray[$data['row']['perms_groupid']]['title'] : ($data['row']['perms_groupid'] ? $data['row']['perms_groupid'] : ''); if ($data['row']['perms_groupid'] && !$beGroupArray[$data['row']['perms_groupid']]) { $groupName = SC_mod_web_perm_ajax::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(GeneralUtility::fixed_lgd_cs($groupName, 20)), FALSE); } else { $groupName = SC_mod_web_perm_ajax::renderGroupname($pageId, $data['row']['perms_groupid'], htmlspecialchars(GeneralUtility::fixed_lgd_cs($groupName, 20))); } // Seeing if editing of permissions are allowed for that page: $editPermsAllowed = $data['row']['perms_userid'] == $GLOBALS['BE_USER']->user['uid'] || $GLOBALS['BE_USER']->isAdmin(); // First column: $cellAttrib = $data['row']['_CSSCLASS'] ? ' class="' . $data['row']['_CSSCLASS'] . '"' : ''; $cells[] = '<td align="left" nowrap="nowrap"' . ($cellAttrib ? $cellAttrib : $bgCol) . $this->generateTitleAttribute($data['row']['uid'], $beUserArray, $beGroupArray) . '>' . $data['HTML'] . htmlspecialchars(GeneralUtility::fixed_lgd_cs($data['row']['title'], $tLen)) . '</td>'; // "Edit permissions" -icon if ($editPermsAllowed && $pageId) { $aHref = BackendUtility::getModuleUrl('web_perm') . '&mode=' . $this->MOD_SETTINGS['mode'] . '&depth=' . $this->MOD_SETTINGS['depth'] . '&id=' . ($data['row']['_ORIG_uid'] ? $data['row']['_ORIG_uid'] : $pageId) . '&return_id=' . $this->id . '&edit=1'; $cells[] = '<td' . $bgCol . '><a href="' . htmlspecialchars($aHref) . '" title="' . $GLOBALS['LANG']->getLL('ch_permissions', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-open') . '</a></td>'; } else { $cells[] = '<td' . $bgCol . '></td>'; } if (!$disableOldPermissionSystem) { $cells[] = ' <td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_user'], $pageId, 'user') . ' ' . $userName : '') . '</td> <td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_group'], $pageId, 'group') . ' ' . $groupName : '') . '</td> <td' . $bgCol . ' nowrap="nowrap">' . ($pageId ? ' ' . SC_mod_web_perm_ajax::renderPermissions($data['row']['perms_everybody'], $pageId, 'everybody') : '') . '</td> <td' . $bgCol . ' nowrap="nowrap">' . ($data['row']['editlock'] ? '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'1\');" title="' . $GLOBALS['LANG']->getLL('EditLock_descr', TRUE) . '">' . IconUtility::getSpriteIcon('status-warning-lock') . '</a></span>' : ($pageId === 0 ? '' : '<span id="el_' . $pageId . '" class="editlock"><a class="editlock" onclick="WebPermissions.toggleEditLock(\'' . $pageId . '\', \'0\');" title="Enable the »Admin-only« edit lock for this page">[+]</a></span>')) . '</td> '; } // ACL rows if (!empty($aclUsers)) { $cells[] = '<td' . $bgCol . '>' . $this->countAcls($this->aclList[$data['row']['uid']][0]) . '</td>'; foreach ($aclUsers as $uid) { $tmpBg = $bgCol; if (isset($this->aclList[$data['row']['uid']][0][$uid]['newAcl'])) { if ($this->aclList[$data['row']['uid']][0][$uid]['recursive']) { $tmpBg = ' class="bgColor5"'; } else { $tmpBg = ' class="bgColor6"'; } } $cells[] = '<td' . $tmpBg . ' nowrap="nowrap">' . ($data['row']['uid'] ? ' ' . $this->printPerms($this->aclList[$data['row']['uid']][0][$uid]['permissions']) : '') . '</td>'; } } if (!empty($aclGroups)) { $cells[] = '<td' . $bgCol . '>' . $this->countAcls($this->aclList[$data['row']['uid']][1]) . '</td>'; foreach ($aclGroups as $uid) { $tmpBg = $bgCol; if (isset($this->aclList[$data['row']['uid']][1][$uid]['newAcl'])) { if ($this->aclList[$data['row']['uid']][1][$uid]['recursive']) { $tmpBg = ' class="bgColor5"'; } else { $tmpBg = ' class="bgColor6"'; } } $cells[] = '<td' . $tmpBg . ' nowrap="nowrap">' . ($data['row']['uid'] ? ' ' . $this->printPerms($this->aclList[$data['row']['uid']][1][$uid]['permissions']) : '') . '</td>'; } } // Compile table row: $code .= '<tr>' . implode('', $cells) . '</tr>'; } // Wrap rows in table tags: $code = '<table class="t3-table" id="typo3-permissionList">' . $code . '</table>'; // Adding the content as a section: $this->content .= $this->doc->section('', $code); // CSH for permissions setting $this->content .= BackendUtility::cshItem('xMOD_csh_corebe', 'perm_module', $GLOBALS['BACK_PATH'], '<br />|'); // Creating legend table: $legendText = '<strong>' . $GLOBALS['LANG']->getLL('1', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('1_t', TRUE); $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('16', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('16_t', TRUE); $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('2', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('2_t', TRUE); $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('4', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('4_t', TRUE); $legendText .= '<br /><strong>' . $GLOBALS['LANG']->getLL('8', TRUE) . '</strong>: ' . $GLOBALS['LANG']->getLL('8_t', TRUE); $code = '<div id="permission-information"> <img' . IconUtility::skinImg($GLOBALS['BACK_PATH'], 'gfx/legend.gif', 'width="86" height="75"') . ' alt="" /> <div class="text">' . $legendText . '</div></div>'; $code .= '<div id="perm-legend">' . $GLOBALS['LANG']->getLL('def', TRUE); $code .= '<br /><br />' . IconUtility::getSpriteIcon('status-status-permission-granted') . ': ' . $GLOBALS['LANG']->getLL('A_Granted', TRUE); $code .= '<br />' . IconUtility::getSpriteIcon('status-status-permission-denied') . ': ' . $GLOBALS['LANG']->getLL('A_Denied', TRUE); $code .= '</div>'; // Adding section with legend code: $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('Legend') . ':', $code, TRUE, TRUE); }