本文整理汇总了PHP中is_admin_for_module函数的典型用法代码示例。如果您正苦于以下问题:PHP is_admin_for_module函数的具体用法?PHP is_admin_for_module怎么用?PHP is_admin_for_module使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_admin_for_module函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preDisplay
/**
* @see SugarView::preDisplay()
*/
public function preDisplay()
{
global $current_user, $mod_strings;
if (!is_admin($current_user) && !is_admin_for_module($GLOBALS['current_user'], 'Campaigns')) {
sugar_die($mod_strings['LBL_UNAUTH_ACCESS']);
}
}
示例2: display
function display()
{
global $current_user, $app_strings, $mod_strings;
$admin = is_admin($current_user) || is_admin_for_module($current_user, 'Reports');
foreach ($this->data['data'] as $i => $rowData) {
if (isset($this->data['data'][$i]['IS_PUBLISHED'])) {
$this->data['data'][$i]['IS_PUBLISHED'] = "<input type='checkbox' ";
if ($rowData['IS_PUBLISHED'] == 'yes') {
$this->data['data'][$i]['IS_PUBLISHED'] .= ' checked ';
}
if ($admin) {
$this->data['data'][$i]['IS_PUBLISHED'] .= " onclick='location.href=\"index.php?module=Reports&action=index&publish=no&publish_report_id={$rowData['ID']}\";'>";
} else {
$this->data['data'][$i]['IS_PUBLISHED'] .= ' disabled=true>';
}
}
if (isset($this->data['data'][$i]['IS_SCHEDULED'])) {
$this->data['data'][$i]['IS_SCHEDULED'] = "<a href='#' onclick=\"schedulePOPUP('{$rowData['ID']}'); return false\" class='listViewTdToolsS1'>{$rowData['IS_SCHEDULED_IMG']} {$rowData['IS_SCHEDULED']}</a>";
}
if (!isset($this->data['data'][$i]['IS_EDIT'])) {
if ($this->data['data'][$i]['ASSIGNED_USER_ID'] != $current_user->id || !ACLController::checkAccess('Reports', 'edit', $this->data['data'][$i]['ASSIGNED_USER_ID'])) {
$this->data['data'][$i]['IS_EDIT'] = " ";
} else {
$this->data['data'][$i]['IS_EDIT'] = "<a title=\"{$app_strings['LBL_EDIT_BUTTON']}\" href=\"index.php?action=ReportsWizard&module=Reports&page=report&record={$rowData['ID']}\">" . SugarThemeRegistry::current()->getImage("edit_inline", '', null, null, ".gif", $mod_strings['LBL_EDIT']) . "</a>";
}
}
}
$this->ss->assign('act', 'ReportsWizard');
return parent::display();
}
示例3: process
public function process()
{
if (!is_admin($GLOBALS['current_user']) && !is_admin_for_module($GLOBALS['current_user'], 'Contracts')) {
$this->hasAccess = false;
}
parent::process();
}
示例4: preDisplay
/**
* @see SugarView::preDisplay()
*/
public function preDisplay()
{
global $current_user;
if (!is_admin($current_user) && !is_admin_for_module($GLOBALS['current_user'], 'Emails') && !is_admin_for_module($GLOBALS['current_user'], 'Campaigns')) {
sugar_die("Unauthorized access to administration.");
}
}
示例5: preDisplay
public function preDisplay()
{
if (!is_admin($GLOBALS['current_user']) && !is_admin_for_module($GLOBALS['current_user'], 'Users')) {
sugar_die("Unauthorized access to administration.");
}
$this->lv = new ListViewSmarty();
$this->lv->delete = false;
}
示例6: preDisplay
public function preDisplay()
{
global $current_user;
if (!is_admin($current_user) && !is_admin_for_module($current_user, 'Forecasts')) {
sugar_die("Unauthorized access to administration.");
}
$this->lv = new ListViewSmarty();
$this->lv->showMassupdateFields = false;
}
示例7: preDisplay
public function preDisplay()
{
if (!is_admin($GLOBALS['current_user']) && !is_admin_for_module($GLOBALS['current_user'], 'Users')) {
sugar_die('No Access');
}
$this->lv = new ListViewSmarty();
$this->lv->export = false;
$this->lv->showMassupdateFields = false;
}
示例8: preDisplay
/**
* @see SugarView::preDisplay()
*/
public function preDisplay()
{
global $current_user;
if (!is_admin($current_user) && !is_admin_for_module($current_user, 'Campaigns')) {
sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
}
$this->lv = new ListViewSmarty();
$this->lv->export = false;
$this->lv->quickViewLinks = false;
}
示例9: preDisplay
public function preDisplay()
{
if (!is_admin($GLOBALS['current_user']) && !is_admin_for_module($GLOBALS['current_user'], 'Users')) {
//instead of just dying here with unauthorized access will send the user back to his/her settings
SugarApplication::redirect('index.php?module=Users&action=DetailView&record=' . $GLOBALS['current_user']->id);
}
$this->lv = new ListViewSmarty();
$this->lv->delete = false;
$this->lv->email = false;
}
示例10: action_delete
protected function action_delete()
{
if ($_REQUEST['record'] != $GLOBALS['current_user']->id && (is_admin($GLOBALS['current_user']) || is_admin_for_module($GLOBALS['current_user'], 'Users'))) {
$u = new User();
$u->retrieve($_REQUEST['record']);
$u->deleted = 1;
$u->status = 'Inactive';
$u->employee_status = 'Terminated';
$u->save();
$GLOBALS['log']->info("User id: {$GLOBALS['current_user']->id} deleted user record: {$_REQUEST['record']}");
SugarApplication::redirect("index.php?module=Employees&action=index");
} else {
sugar_die("Unauthorized access to administration.");
}
}
示例11: listViewProcess
function listViewProcess()
{
$this->processSearchForm();
$this->lv->searchColumns = $this->searchForm->searchColumns;
if (!$this->headers) {
return;
}
if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
$this->lv->ss->assign("SEARCH", true);
$tplFile = 'include/ListView/ListViewGeneric.tpl';
if (!is_admin($GLOBALS['current_user']) && !is_admin_for_module($GLOBALS['current_user'], 'Users')) {
$tplFile = 'include/ListView/ListViewNoMassUpdate.tpl';
}
$this->lv->setup($this->seed, $tplFile, $this->where, $this->params);
$savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : ' - ' . $_REQUEST['saved_search_select_name'];
echo $this->lv->display();
}
}
示例12: loadImportBean
/**
* Returns the bean object of the given module
*
* @param string $module
* @return object
*/
function loadImportBean($module)
{
$focus = loadBean($module);
if ($focus) {
if (!$focus->importable) {
return false;
}
if ($module == 'Users' && !is_admin($GLOBALS['current_user']) && !is_admin_for_module($GLOBALS['current_user'], 'Users')) {
return false;
}
if ($focus->bean_implements('ACL')) {
if (!ACLController::checkAccess($focus->module_dir, 'import', true)) {
ACLController::displayNoAccess();
sugar_die('');
}
}
} else {
return false;
}
return $focus;
}
示例13: display
function display()
{
if (is_admin($GLOBALS['current_user']) || $_REQUEST['record'] == $GLOBALS['current_user']->id) {
$this->ss->assign('DISPLAY_EDIT', true);
}
if (is_admin($GLOBALS['current_user'])) {
$this->ss->assign('DISPLAY_DUPLICATE', true);
}
$showDeleteButton = FALSE;
if ($_REQUEST['record'] != $GLOBALS['current_user']->id && (is_admin($GLOBALS['current_user']) || is_admin_for_module($GLOBALS['current_user'], 'Users'))) {
$showDeleteButton = TRUE;
if (empty($this->bean->user_name)) {
//Indicates just employee
$deleteWarning = $GLOBALS['mod_strings']['LBL_DELETE_EMPLOYEE_CONFIRM'];
} else {
$deleteWarning = $GLOBALS['mod_strings']['LBL_DELETE_USER_CONFIRM'];
}
$this->ss->assign('DELETE_WARNING', $deleteWarning);
}
$this->ss->assign('DISPLAY_DELETE', $showDeleteButton);
parent::display();
}
示例14: getModuleTitle
/**
* Return the "breadcrumbs" to display at the top of the page
*
* @param bool $show_help optional, true if we show the help links
* @return HTML string containing breadcrumb title
*/
public function getModuleTitle($show_help = true)
{
global $sugar_version, $sugar_flavor, $server_unique_key, $current_language, $action, $current_user;
$theTitle = "<div class='moduleTitle'>\n";
$module = preg_replace("/ /", "", $this->module);
$params = $this->_getModuleTitleParams();
$count = count($params);
$index = 0;
if (SugarThemeRegistry::current()->directionality == "rtl") {
$params = array_reverse($params);
}
$paramString = '';
foreach ($params as $parm) {
$index++;
$paramString .= $parm;
if ($index < $count) {
$paramString .= $this->getBreadCrumbSymbol();
}
}
if (!empty($paramString)) {
$theTitle .= "<h2> {$paramString} </h2>\n";
}
if ($show_help) {
$theTitle .= "<span class='utils'>";
if (is_admin($current_user) || is_admin_for_module($current_user, $this->module)) {
$createImageURL = SugarThemeRegistry::current()->getImageURL('create-record.gif');
$theTitle .= <<<EOHTML
<a href="index.php?module={$module}&action=EditView&return_module={$module}&return_action=DetailView" class="utilsLink">
<img src='{$createImageURL}' alt='{$GLOBALS['app_strings']['LNK_CREATE']}'></a>
<a href="index.php?module={$module}&action=EditView&return_module={$module}&return_action=DetailView" class="utilsLink">
{$GLOBALS['app_strings']['LNK_CREATE']}
</a>
EOHTML;
}
}
$theTitle .= "</span></div>\n";
return $theTitle;
}
示例15: sugar_die
sugar_die("Unauthorized access to user administration.");
}
$focus = new User();
$focus->retrieve($_POST['record']);
// Flag to determine whether to save a new password or not.
if (empty($focus->id)) {
$newUser = true;
} else {
$newUser = false;
}
if (!$current_user->is_admin && !is_admin_for_module($GLOBALS['current_user'], 'Users') && $current_user->id != $focus->id) {
$GLOBALS['log']->fatal("SECURITY:Non-Admin " . $current_user->id . " attempted to change settings for user:" . $focus->id);
header("Location: index.php?module=Users&action=Logout");
exit;
}
if (!$current_user->is_admin && !is_admin_for_module($GLOBALS['current_user'], 'Users') && !empty($_POST['is_admin'])) {
$GLOBALS['log']->fatal("SECURITY:Non-Admin " . $current_user->id . " attempted to change is_admin settings for user:" . $focus->id);
header("Location: index.php?module=Users&action=Logout");
exit;
}
$portal = array("sugar_user_name", "last_name", "status", "portal_only");
$group = array("sugar_user_name", "last_name", "status", "is_group");
if (isset($_POST['portal_only']) && ($_POST['portal_only'] == '1' || $focus->portal_only)) {
foreach ($portal as $field) {
if (isset($_POST[$field])) {
$value = $_POST[$field];
$focus->{$field} = $value;
}
}
}
if (isset($_POST['is_group']) && ($_POST['is_group'] == '1' || $focus->is_group)) {