本文整理汇总了PHP中BackendAuthentication::isAllowedAction方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendAuthentication::isAllowedAction方法的具体用法?PHP BackendAuthentication::isAllowedAction怎么用?PHP BackendAuthentication::isAllowedAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BackendAuthentication
的用法示例。
在下文中一共展示了BackendAuthentication::isAllowedAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parse
/**
* Parse the form
*/
protected function parse()
{
parent::parse();
// assign the data
$this->tpl->assign('item', $this->record);
$this->tpl->assign('showDeleteCategory', BackendFaqModel::deleteCategoryAllowed($this->id) && BackendAuthentication::isAllowedAction('delete_category'));
}
示例2: loadDatagrids
/**
* Loads the dataGrids
*/
private function loadDatagrids()
{
// load all categories
$categories = BackendFaqModel::getCategories(true);
// loop categories and create a dataGrid for each one
foreach ($categories as $categoryId => $categoryTitle) {
$dataGrid = new BackendDataGridDB(BackendFaqModel::QRY_DATAGRID_BROWSE, array(BL::getWorkingLanguage(), $categoryId));
$dataGrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop'));
$dataGrid->setColumnsHidden(array('category_id', 'sequence'));
$dataGrid->addColumn('dragAndDropHandle', null, '<span>' . BL::lbl('Move') . '</span>');
$dataGrid->setColumnsSequence('dragAndDropHandle');
$dataGrid->setColumnAttributes('question', array('class' => 'title'));
$dataGrid->setColumnAttributes('dragAndDropHandle', array('class' => 'dragAndDropHandle'));
$dataGrid->setRowAttributes(array('id' => '[id]'));
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('edit')) {
$dataGrid->setColumnURL('question', BackendModel::createURLForAction('edit') . '&id=[id]');
$dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]', BL::lbl('Edit'));
}
// add dataGrid to list
$this->dataGrids[] = array('id' => $categoryId, 'title' => $categoryTitle, 'content' => $dataGrid->getContent());
}
// set empty datagrid
$this->emptyDatagrid = new BackendDataGridArray(array(array('dragAndDropHandle' => '', 'question' => BL::msg('NoQuestionInCategory'), 'edit' => '')));
$this->emptyDatagrid->setAttributes(array('class' => 'dataGrid sequenceByDragAndDrop emptyGrid'));
$this->emptyDatagrid->setHeaderLabels(array('edit' => null, 'dragAndDropHandle' => null));
}
示例3: loadDataGrid
/**
* Load the datagrid
*/
public function loadDataGrid()
{
$this->dataGrid = new BackendDataGridDB(BackendGroupsModel::QRY_BROWSE);
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('edit')) {
$this->dataGrid->setColumnURL('name', BackendModel::createURLForAction('edit') . '&id=[id]');
$this->dataGrid->setColumnURL('num_users', BackendModel::createURLForAction('edit') . '&id=[id]#tabUsers');
$this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]');
}
}
示例4: loadDataGrid
/**
* Load the datagrids
*/
private function loadDataGrid()
{
$this->dataGrid = new BackendDataGridDB(BackendContentBlocksModel::QRY_BROWSE, array('active', BL::getWorkingLanguage()));
$this->dataGrid->setSortingColumns(array('title'));
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('edit')) {
$this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit') . '&id=[id]');
$this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]', BL::lbl('Edit'));
}
}
示例5: parse
/**
* Parse into template
*/
private function parse()
{
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('settings', 'analytics')) {
// parse redirect link
$this->tpl->assign('settingsUrl', BackendModel::createURLForAction('settings', 'analytics'));
}
$this->parseKeywords();
$this->parseReferrers();
}
示例6: loadDataGrid
/**
* Load the datagrids
*/
private function loadDataGrid()
{
// create datagrid
$this->dataGrid = new BackendDataGridDB(BackendExtensionsModel::QRY_BROWSE_TEMPLATES, array($this->selectedTheme));
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('edit_theme_template')) {
// set colum URLs
$this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit_theme_template') . '&id=[id]');
// add edit column
$this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_theme_template') . '&id=[id]', BL::lbl('Edit'));
}
}
示例7: loadDataGrid
/**
* Load the datagrid.
*/
private function loadDataGrid()
{
// create datagrid with an overview of all active and undeleted users
$this->dataGrid = new BackendDataGridDB(BackendUsersModel::QRY_BROWSE, array('N'));
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('edit')) {
// add column
$this->dataGrid->addColumn('nickname', SpoonFilter::ucfirst(BL::lbl('Nickname')), null, BackendModel::createURLForAction('edit') . '&id=[id]', BL::lbl('Edit'));
// add edit column
$this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit') . '&id=[id]');
}
// show the user's nickname
$this->dataGrid->setColumnFunction(array('BackendUser', 'getSettingByUserId'), array('[id]', 'nickname'), 'nickname', false);
}
示例8: checkSettings
/**
* Checks the settings and optionally returns an array with warnings
*
* @return array
*/
public static function checkSettings()
{
$warnings = array();
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('settings', 'mailmotor')) {
// analytics session token
if (BackendModel::getModuleSetting('mailmotor', 'cm_account') == false) {
$warnings[] = array('message' => sprintf(BL::err('AnalysisNoCMAccount', 'mailmotor'), BackendModel::createURLForAction('settings', 'mailmotor')));
} elseif (BackendModel::getModuleSetting('mailmotor', 'cm_client_id') == '') {
// add warning
$warnings[] = array('message' => sprintf(BL::err('AnalysisNoCMClientID', 'mailmotor'), BackendModel::createURLForAction('settings', 'mailmtor')));
}
}
return $warnings;
}
示例9: loadDataGridInstalled
/**
* Load the data grid for installed modules.
*/
private function loadDataGridInstalled()
{
// create datagrid
$this->dataGridInstalledModules = new BackendDataGridArray($this->installedModules);
$this->dataGridInstalledModules->setSortingColumns(array('name'));
$this->dataGridInstalledModules->setColumnsHidden(array('installed', 'raw_name', 'cronjobs_active'));
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('detail_module')) {
$this->dataGridInstalledModules->setColumnURL('name', BackendModel::createURLForAction('detail_module') . '&module=[raw_name]');
$this->dataGridInstalledModules->addColumn('details', null, BL::lbl('Details'), BackendModel::createURLForAction('detail_module') . '&module=[raw_name]', BL::lbl('Details'));
}
// add the greyed out option to modules that have warnings
$this->dataGridInstalledModules->addColumn('hidden');
$this->dataGridInstalledModules->setColumnFunction(array('BackendExtensionsModel', 'hasModuleWarnings'), array('[raw_name]'), array('hidden'));
}
示例10: checkSettings
/**
* Checks the settings and optionally returns an array with warnings
*
* @return array
*/
public static function checkSettings()
{
$warnings = array();
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('settings', 'blog')) {
// rss title
if (BackendModel::getModuleSetting('blog', 'rss_title_' . BL::getWorkingLanguage(), null) == '') {
$warnings[] = array('message' => sprintf(BL::err('RSSTitle', 'blog'), BackendModel::createURLForAction('settings', 'blog')));
}
// rss description
if (BackendModel::getModuleSetting('blog', 'rss_description_' . BL::getWorkingLanguage(), null) == '') {
$warnings[] = array('message' => sprintf(BL::err('RSSDescription', 'blog'), BackendModel::createURLForAction('settings', 'blog')));
}
}
return $warnings;
}
示例11: loadDataGrid
/**
* Loads the datagrids
*/
private function loadDataGrid()
{
// create datagrid
$this->dataGrid = new BackendDataGridDB(BackendSearchModel::QRY_DATAGRID_BROWSE_SYNONYMS, BL::getWorkingLanguage());
// sorting columns
$this->dataGrid->setSortingColumns(array('term'), 'term');
// column function
$this->dataGrid->setColumnFunction('str_replace', array(',', ', ', '[synonym]'), 'synonym', true);
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('edit_synonym')) {
// set colum URLs
$this->dataGrid->setColumnURL('term', BackendModel::createURLForAction('edit_synonym') . '&id=[id]');
// add column
$this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_synonym') . '&id=[id]', BL::lbl('Edit'));
}
}
示例12: checkSettings
/**
* Checks the settings and optionally returns an array with warnings
*
* @return array
*/
public static function checkSettings()
{
$warnings = array();
// check if debug-mode is active
if (SPOON_DEBUG) {
$warnings[] = array('message' => BL::err('DebugModeIsActive'));
}
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('index', 'settings')) {
// check if the fork API keys are available
if (self::getModuleSetting('core', 'fork_api_private_key') == '' || self::getModuleSetting('core', 'fork_api_public_key') == '') {
$warnings[] = array('message' => sprintf(BL::err('ForkAPIKeys'), BackendModel::createURLForAction('index', 'settings')));
}
}
// check for extensions warnings
$warnings = array_merge($warnings, BackendExtensionsModel::checkSettings());
return $warnings;
}
示例13: loadDataGrid
/**
* Loads the dataGrid
*/
private function loadDataGrid()
{
// create dataGrid
$this->dataGrid = new BackendDataGridDB(BackendFaqModel::QRY_DATAGRID_BROWSE_CATEGORIES, BL::getWorkingLanguage());
$this->dataGrid->setHeaderLabels(array('num_items' => SpoonFilter::ucfirst(BL::lbl('Amount'))));
$this->dataGrid->enableSequenceByDragAndDrop();
$this->dataGrid->setRowAttributes(array('id' => '[id]'));
$this->dataGrid->setPaging(false);
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('index')) {
$this->dataGrid->setColumnFunction(array(__CLASS__, 'setClickableCount'), array('[num_items]', BackendModel::createURLForAction('index') . '&category=[id]'), 'num_items', true);
}
// check if this action is allowed
if (BackendAuthentication::isAllowedAction('edit_category')) {
$this->dataGrid->setColumnURL('title', BackendModel::createURLForAction('edit_category') . '&id=[id]');
$this->dataGrid->addColumn('edit', null, BL::lbl('Edit'), BackendModel::createURLForAction('edit_category') . '&id=[id]', BL::lbl('Edit'));
}
}
示例14: __construct
/**
* You have to specify the action and module so we know what to do with this instance
*
* @param string $action The action to load.
* @param string $module The module to load.
*/
public function __construct($action, $module)
{
$this->setModule($module);
$this->setAction($action);
$this->loadConfig();
$allowed = false;
// is this an allowed action
if (BackendAuthentication::isAllowedAction($action, $this->getModule())) {
$allowed = true;
}
// is this an allowed AJAX-action?
if (!$allowed) {
// set correct headers
SpoonHTTP::setHeadersByCode(403);
// output
$fakeAction = new BackendBaseAJAXAction('', '');
$fakeAction->output(BackendBaseAJAXAction::FORBIDDEN, null, 'Not logged in.');
}
}
示例15: parseNumForms
/**
* Parse amount of forms sent for the datagrid
*
* @param int $formId Id of the form.
* @param int $sentForms Amount of sent forms.
* @return string
*/
public static function parseNumForms($formId, $sentForms)
{
// redefine
$formId = (int) $formId;
$sentForms = (int) $sentForms;
// one form sent
if ($sentForms == 1) {
$output = BL::getMessage('OneSentForm');
} elseif ($sentForms > 1) {
$output = sprintf(BL::getMessage('SentForms'), $sentForms);
} else {
$output = sprintf(BL::getMessage('SentForms'), $sentForms);
}
// check if data action is allowed
if (BackendAuthentication::isAllowedAction('data', 'form_builder')) {
// output
$output = '<a href="' . BackendModel::createURLForAction('data') . '&id=' . $formId . '" title="' . $output . '">' . $output . '</a>';
}
return $output;
}