当前位置: 首页>>代码示例>>PHP>>正文


PHP can_manage_security函数代码示例

本文整理汇总了PHP中can_manage_security函数的典型用法代码示例。如果您正苦于以下问题:PHP can_manage_security函数的具体用法?PHP can_manage_security怎么用?PHP can_manage_security使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了can_manage_security函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: users_and_groups

 function users_and_groups()
 {
     if (!can_manage_security(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     tpl_assign('only_full_users', array_var($_REQUEST, 'only_full_users'));
     ajx_set_no_toolbar();
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:10,代码来源:MoreController.class.php

示例2: create_user

 /**
  * Creates a system user, receiving a Contact id
  *
  */
 function create_user()
 {
     $contact = Contacts::findById(get_id());
     if (!$contact instanceof Contact) {
         flash_error(lang('contact dnx'));
         ajx_current("empty");
         return;
     }
     // if
     if (!can_manage_security(logged_user())) {
         flash_error(lang('no permissions'));
         ajx_current("empty");
         return;
     }
     // if
     $this->redirectTo('user', 'add', array('company_id' => $contact->getCompanyId(), 'contact_id' => $contact->getId()));
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:21,代码来源:ContactController.class.php

示例3: require_javascript

<?php

require_javascript('og/tasks/main.js');
require_javascript('og/time/main.js');
require_javascript('og/time/drawing.js');
$show_billing = can_manage_security(logged_user()) && logged_user()->isAdministrator();
$genid = gen_id();
$tasks_array = array();
$timeslots_array = array();
$users_array = array();
$companies_array = array();
if (isset($tasks)) {
    foreach ($tasks as $task) {
        $tasks_array[] = $task->getArrayInfo();
    }
}
if (isset($timeslots)) {
    foreach ($timeslots as $timeslot) {
        $timeslots_array[] = $timeslot->getArrayInfo($show_billing);
    }
}
if (isset($users)) {
    foreach ($users as $user) {
        $users_array[] = $user->getArrayInfo();
    }
}
if (isset($companies)) {
    foreach ($companies as $company) {
        $companies_array[] = $company->getArrayInfo();
    }
}
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:31,代码来源:index.php

示例4: edit_permissions

 function edit_permissions()
 {
     if (!can_manage_security(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     $member = Members::findById(get_id());
     if (!$member instanceof Member) {
         flash_error(lang('member dnx'));
         ajx_current("empty");
         return;
     }
     if (!array_var($_POST, 'permissions')) {
         $permission_parameters = permission_member_form_parameters($member);
         tpl_assign('permission_parameters', $permission_parameters);
     } else {
         try {
             DB::beginWork();
             save_member_permissions($member);
             DB::commit();
             flash_success(lang('success user permissions updated'));
             ajx_current("back");
         } catch (Exception $e) {
             DB::rollback();
             flash_error($e->getMessage());
             ajx_current("empty");
         }
     }
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:30,代码来源:MemberController.class.php

示例5: echo

					$indent = 16 * $mem->getDepth();
?>
						<div style="margin-left:<?php echo $indent?>px;width:<?php echo 800 - $indent?>px;" id="abm-members-item-container-<?php echo $mem->getId() ?>"
							class="<?php echo ($mem->getArchivedById() > 0 ? "member-item-archived" : "")?><?php echo ($alt ? " edit-mem-alt" : "")?>"
							onmouseover="og.editMembers.showHideOptions('<?php echo $genid?>actions<?php echo $mem->getId()?>', <?php echo $mem->getId()?>, true);" 
							onmouseout="og.editMembers.showHideOptions('<?php echo $genid?>actions<?php echo $mem->getId()?>', <?php echo $mem->getId()?>, false);">

							<table style="width:100%;"><tr><td style="width:500px;">
								<span class="coViewAction <?php echo $mem->getIconClass()?>">&nbsp;</span>
								<span class="abm-members-name"><?php echo $mem->getName() . ($mem->getArchivedById() > 0 ? " (".lang('archived').")" : "");?></span>
							</td><td>
								<span style="float:right;opacity:0.25;filter:alpha(opacity=25);font-weight:normal;" id="<?php echo $genid?>actions<?php echo $mem->getId()?>">
								<?php if (can_manage_dimension_members(logged_user())) : ?>
									<a href="<?php echo get_url('member', 'edit', array('id' => $mem->getId()))?>" class="db-ico ico-edit" style="padding:4px 10px 0 16px;"><?php echo lang('edit')?></a>
								<?php endif; ?>
								<?php if ($dimension->getDefinesPermissions() && can_manage_security(logged_user())) : ?>	
									<a href="<?php echo get_url('member', 'edit_permissions', array('id' => $mem->getId()))?>" class="db-ico ico-permissions" style="padding:4px 10px 0 16px;"><?php echo lang('permissions')?></a>
								<?php endif; ?>
								<?php if (can_manage_dimension_members(logged_user())) : ?>
									<a href="<?php echo "javascript:if(confirm(lang('confirm delete permanently'))) og.openLink('" . get_url('member', 'delete', array('id' => $mem->getId(), 'dont_reload' => true)) ."', {callback: function(success, data){if (success) Ext.get('abm-members-item-container-".$mem->getId()."').remove()}});"?>" 
										class="db-ico ico-delete" style="padding:4px 0 0 16px;"><?php echo lang('delete')?></a>
								<?php endif; ?>
								</span>
							</td></tr></table>
						</div>
<?php			}
			} ?>
			<?php if (can_manage_dimension_members(logged_user())) : ?>
				<div style="margin-top:10px;"><a class="db-ico ico-add" style="padding:3px 0 0 20px;" href="<?php echo get_url('member', 'add', array("dim_id" => $dimension->getId()))?>">
					<?php echo lang('add member to this dimension')?>
				</a></div>
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:edit_members.php

示例6: IN

		}
		
		$contacts = Contacts::findAll(array(
			'conditions' => 'object_id IN ('.implode(',',$intersection).') AND `is_company` = 0 AND disabled = 0',
			'limit' => $limit,
			'order' => 'last_activity, updated_on',
			'order_dir' => 'desc',
		));
		$total = count($contacts);
		
		$widget_title = lang("people in", implode(", ", $mnames));
	
	} else {
		
		$result = Contacts::instance()->listing(array(
			"order" => "last_activity, updated_on",
			"order_dir" => "desc",
			"extra_conditions" => " AND `is_company` = 0 AND disabled = 0 AND user_type > 0",
			"start" => 0,
			"limit" => $limit
		));
		$total = $result->total ;
		$contacts = $result->objects;
	}
	
	$render_add = can_manage_security(logged_user());
	$genid = gen_id();
	
	if ($total > 0 || $render_add) {
		include_once 'template.php';
	}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:index.php

示例7: documents_allow_submit

 function documents_allow_submit()
 {
     ajx_current("empty");
     if (!can_manage_security(logged_user())) {
         flash_error(lang('no access permissions'));
         ajx_current("empty");
         return;
     }
     foreach ($_POST['file_types'] as $id => $extension) {
         $allow = $extension['allow'] == "on" ? 1 : 0;
         if ($ft = FileTypes::instance()->findById($id)) {
             $ft->setIsAllow($allow);
             $ft->save();
         }
     }
     flash_success(lang('success file extension'));
 }
开发者ID:abhinay100,项目名称:feng_app,代码行数:17,代码来源:AdministrationController.class.php

示例8: canEdit

 /**
  * Check if specific user can edit this contact
  *
  * @access public
  * @param User $user
  * @return boolean
  */
 function canEdit(User $user)
 {
     if ($this->getUserId()) {
         // a contact that has a user assigned to it can be modified by anybody that can manage security (this is: users and permissions) or the user himself.
         return can_manage_contacts($user, true) || can_manage_security($user) || $this->getUserId() == $user->getId() || can_write($user, $this);
     } else {
         return can_manage_contacts($user, true) || can_write($user, $this);
     }
 }
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:16,代码来源:Contact.class.php

示例9: array

if (can_edit_company_data(logged_user())) {
    $icons[] = array('ico' => 'ico-large-user', 'url' => get_url('administration', 'members'), 'name' => lang('users'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . owner_company()->getAddUserUrl() . '">' . lang('add user') . '</a>');
}
if (can_manage_security(logged_user())) {
    $icons[] = array('ico' => 'ico-large-group', 'url' => get_url('administration', 'groups'), 'name' => lang('groups'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . owner_company()->getAddGroupUrl() . '">' . lang('add group') . '</a>');
}
if (can_manage_workspaces(logged_user())) {
    $icons[] = array('ico' => 'ico-large-workspace', 'url' => get_url('administration', 'projects'), 'name' => lang('projects'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . get_url('project', 'add') . '">' . lang('add project') . '</a>');
}
if (can_manage_security(logged_user())) {
    $icons[] = array('ico' => 'ico-large-email', 'url' => get_url('administration', 'mail_accounts'), 'name' => lang('mail accounts'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . get_url('mail', 'add_account') . '">' . lang('add mail account') . '</a>');
}
if (can_manage_templates(logged_user())) {
    $icons[] = array('ico' => 'ico-large-template', 'url' => get_url('template', 'index'), 'name' => lang('templates'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . get_url('template', 'add') . '">' . lang('add template') . '</a>');
}
if (can_manage_security(logged_user())) {
    $icons[] = array('ico' => 'ico-large-billing', 'url' => get_url('billing', 'index'), 'name' => lang('billing'), 'extra' => '<a class="internalLink coViewAction ico-add" href="' . get_url('billing', 'add') . '">' . lang('add billing category') . '</a>');
}
if (can_manage_configuration(logged_user())) {
    $icons[] = array('ico' => 'ico-large-custom-properties', 'url' => get_url('administration', 'custom_properties'), 'name' => lang('custom properties'), 'extra' => '');
    $icons[] = array('ico' => 'ico-large-object-subtypes', 'url' => get_url('administration', 'object_subtypes'), 'name' => lang('object subtypes'), 'extra' => '');
    $icons[] = array('ico' => 'ico-large-configuration', 'url' => get_url('administration', 'configuration'), 'name' => lang('configuration'), 'extra' => '');
    $icons[] = array('ico' => 'ico-large-tools', 'url' => get_url('administration', 'tools'), 'name' => lang('administration tools'), 'extra' => '');
    if (!defined('ALLOW_UPGRADING') || ALLOW_UPGRADING) {
        $icons[] = array('ico' => 'ico-large-upgrade', 'url' => get_url('administration', 'upgrade'), 'name' => lang('upgrade'), 'extra' => '');
    }
    if (!defined('ALLOW_CONFIGURING_CRON') || ALLOW_CONFIGURING_CRON) {
        $icons[] = array('ico' => 'ico-large-cron', 'url' => get_url('administration', 'cron_events'), 'name' => lang('cron events'), 'extra' => '');
    }
}
Hook::fire('render_administration_icons', null, $icons);
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:31,代码来源:index.php

示例10: canDelete

 /**
  * Check if specific user can delete this account
  *
  * @access public
  * @param User $user
  * @return boolean
  */
 function canDelete(Contact $user)
 {
     //$accountUser = MailAccountContacts::getByAccountAndContact($this, $user);
     $accountUser = MailAccountContacts::getByAccountAndContact($this, $user);
     return $accountUser instanceof MailAccountContact && $accountUser->getCanEdit() || can_manage_security(logged_user());
 }
开发者ID:rorteg,项目名称:fengoffice,代码行数:13,代码来源:MailAccount.class.php

示例11: array

}
if (array_var($_REQUEST, 'is_user') == 1 && isset($user_type) && $user_type > 0) {
    $on_submit = "og.ogPermPrepareSendData('{$genid}');" . $on_submit;
}
$has_custom_properties = CustomProperties::countAllCustomPropertiesByObjectType($object->getObjectTypeId()) > 0;
$categories = array();
Hook::fire('object_edit_categories', $object, $categories);
$add_contact_lang = lang('add contact');
$new_contact_lang = lang('new contact');
$edit_contact_lang = lang('edit contact');
if (array_var($_REQUEST, 'is_user') == 1 && isset($user_type) && $user_type > 0) {
    $add_contact_lang = lang('add user');
    $new_contact_lang = lang('new user');
    $edit_contact_lang = lang('edit user');
}
$can_change_permissions = $contact->isNew() ? can_manage_security(logged_user()) : $contact->canUpdatePermissions(logged_user());
$all_user_groups = PermissionGroups::instance()->getUserGroupsInfo();
?>

<form id="<?php 
echo $genid;
?>
submit-edit-form" onsubmit="<?php 
echo $on_submit;
?>
" class="internalForm" action="<?php 
echo $contact->isNew() ? $contact->getAddUrl() : $contact->getEditUrl();
?>
" method="post">
<input id="<?php 
echo $genid;
开发者ID:abhinay100,项目名称:feng_app,代码行数:31,代码来源:edit_contact.php

示例12: save_permissions

function save_permissions($pg_id, $is_guest = false, $permissions_data = null, $save_cmps = true, $update_sharing_table = true, $fire_hook = true, $update_contact_member_cache = true, $users_ids_to_check = array(), $only_member_permissions = false)
{
    if (is_null($permissions_data)) {
        // system permissions
        $sys_permissions_data = array_var($_POST, 'sys_perm');
        // module permissions
        $mod_permissions_data = array_var($_POST, 'mod_perm');
        // root permissions
        if ($rp_genid = array_var($_POST, 'root_perm_genid')) {
            $rp_permissions_data = array();
            foreach ($_POST as $name => $value) {
                if (str_starts_with($name, $rp_genid . 'rg_root_')) {
                    $rp_permissions_data[$name] = $value;
                }
            }
        }
        // member permissions
        $permissionsString = array_var($_POST, 'permissions');
    } else {
        // system permissions
        $sys_permissions_data = array_var($permissions_data, 'sys_perm');
        // module permissions
        $mod_permissions_data = array_var($permissions_data, 'mod_perm');
        // root permissions
        $rp_genid = array_var($permissions_data, 'root_perm_genid');
        $rp_permissions_data = array_var($permissions_data, 'root_perm');
        // member permissions
        $permissionsString = array_var($permissions_data, 'permissions');
    }
    try {
        DB::beginWork();
        $changed_members = array();
        // save module permissions
        if (!$only_member_permissions) {
            try {
                TabPanelPermissions::clearByPermissionGroup($pg_id, true);
                if (!is_null($mod_permissions_data) && is_array($mod_permissions_data)) {
                    foreach ($mod_permissions_data as $tab_id => $val) {
                        DB::execute("INSERT INTO " . TABLE_PREFIX . "tab_panel_permissions (permission_group_id,tab_panel_id) VALUES ('{$pg_id}','{$tab_id}') ON DUPLICATE KEY UPDATE permission_group_id=permission_group_id");
                    }
                }
            } catch (Exception $e) {
                Logger::log("Error saving module permissions for permission group {$pg_id}: " . $e->getMessage() . "\n" . $e->getTraceAsString());
                throw $e;
            }
        }
        $root_permissions_sharing_table_delete = array();
        $root_permissions_sharing_table_add = array();
        if (logged_user() instanceof Contact && can_manage_security(logged_user())) {
            try {
                if (!$only_member_permissions) {
                    // save system permissions
                    $system_permissions = SystemPermissions::findById($pg_id);
                    if (!$system_permissions instanceof SystemPermission) {
                        $system_permissions = new SystemPermission();
                        $system_permissions->setPermissionGroupId($pg_id);
                    }
                    $system_permissions->setAllPermissions(false);
                    $other_permissions = array();
                    Hook::fire('add_user_permissions', $pg_id, $other_permissions);
                    foreach ($other_permissions as $k => $v) {
                        $system_permissions->setColumnValue($k, false);
                    }
                    // check max permissions for role, in case of modifying user's permissions
                    $role_id = "-1";
                    $tmp_contact = Contacts::findOne(array('conditions' => 'permission_group_id = ' . $pg_id));
                    if ($tmp_contact instanceof Contact) {
                        $role_id = $tmp_contact->getUserType();
                    }
                    $max_role_system_permissions = MaxSystemPermissions::findOne(array('conditions' => 'permission_group_id = ' . $role_id));
                    if ($max_role_system_permissions instanceof MaxSystemPermission) {
                        foreach ($sys_permissions_data as $col => &$val) {
                            $max_val = $max_role_system_permissions->getColumnValue($col);
                            if (!$max_val) {
                                unset($sys_permissions_data[$col]);
                            }
                        }
                    }
                    // don't allow to write emails for collaborators and guests
                    if ($tmp_contact instanceof Contact) {
                        $user_type_name = $tmp_contact->getUserTypeName();
                        if (!in_array($user_type_name, array('Super Administrator', 'Administrator', 'Manager', 'Executive'))) {
                            $mail_ot = ObjectTypes::findByName('mail');
                            if ($mail_ot instanceof ObjectType) {
                                DB::executeAll("UPDATE " . TABLE_PREFIX . "contact_member_permissions SET can_write=0, can_delete=0 WHERE object_type_id=" . $mail_ot->getId() . " AND permission_group_id={$pg_id}");
                            }
                        }
                    }
                    $sys_permissions_data['can_task_assignee'] = !$is_guest;
                    $system_permissions->setFromAttributes($sys_permissions_data);
                    $system_permissions->setUseOnDuplicateKeyWhenInsert(true);
                    $system_permissions->save();
                    //object type root permissions
                    $can_have_root_permissions = config_option('let_users_create_objects_in_root') && in_array($user_type_name, array('Super Administrator', 'Administrator', 'Manager', 'Executive'));
                    if ($rp_genid && $can_have_root_permissions) {
                        ContactMemberPermissions::delete("permission_group_id = {$pg_id} AND member_id = 0");
                        foreach ($rp_permissions_data as $name => $value) {
                            if (str_starts_with($name, $rp_genid . 'rg_root_')) {
                                $rp_ot = substr($name, strrpos($name, '_') + 1);
                                if (is_numeric($rp_ot) && $rp_ot > 0 && $value == 0) {
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:permissions.php

示例13: create_user

function create_user($user_data, $permissionsString)
{
    $user = new User();
    $user->setUsername(array_var($user_data, 'username'));
    $user->setDisplayName(array_var($user_data, 'display_name'));
    $user->setEmail(array_var($user_data, 'email'));
    $user->setCompanyId(array_var($user_data, 'company_id'));
    $user->setType(array_var($user_data, 'type'));
    $user->setTimezone(array_var($user_data, 'timezone'));
    if (!logged_user() instanceof User || can_manage_security(logged_user())) {
        $user->setCanEditCompanyData(array_var($user_data, 'can_edit_company_data'));
        $user->setCanManageSecurity(array_var($user_data, 'can_manage_security'));
        $user->setCanManageWorkspaces(array_var($user_data, 'can_manage_workspaces'));
        $user->setCanManageConfiguration(array_var($user_data, 'can_manage_configuration'));
        $user->setCanManageContacts(array_var($user_data, 'can_manage_contacts'));
        $user->setCanManageTemplates(array_var($user_data, 'can_manage_templates'));
        $user->setCanManageReports(array_var($user_data, 'can_manage_reports'));
        $user->setCanManageTime(array_var($user_data, 'can_manage_time'));
        $user->setCanAddMailAccounts(array_var($user_data, 'can_add_mail_accounts'));
        $other_permissions = array();
        Hook::fire('add_user_permissions', $user, $other_permissions);
        foreach ($other_permissions as $k => $v) {
            $user->setColumnValue($k, array_var($user_data, $k));
        }
    }
    if (array_var($user_data, 'password_generator', 'random') == 'random') {
        // Generate random password
        $password = UserPasswords::generateRandomPassword();
    } else {
        // Validate input
        $password = array_var($user_data, 'password');
        if (trim($password) == '') {
            throw new Error(lang('password value required'));
        }
        // if
        if ($password != array_var($user_data, 'password_a')) {
            throw new Error(lang('passwords dont match'));
        }
        // if
    }
    // if
    $user->setPassword($password);
    $user->save();
    $user_password = new UserPassword();
    $user_password->setUserId($user->getId());
    $user_password->setPasswordDate(DateTimeValueLib::now());
    $user_password->setPassword(cp_encrypt($password, $user_password->getPasswordDate()->getTimestamp()));
    $user_password->password_temp = $password;
    $user_password->save();
    if (array_var($user_data, 'autodetect_time_zone', 1) == 1) {
        set_user_config_option('autodetect_time_zone', 1, $user->getId());
    }
    if ($user->getType() == 'admin') {
        if ($user->getCompanyId() != owner_company()->getId() || logged_user() instanceof User && !can_manage_security(logged_user())) {
            // external users can't be admins or logged user has no rights to create admins => set as Normal
            $user->setType('normal');
        } else {
            $user->setAsAdministrator(true);
        }
    }
    /* create contact for this user*/
    if (array_var($user_data, 'create_contact', 1)) {
        // if contact with same email exists take it, else create new
        $contact = Contacts::getByEmail($user->getEmail(), true);
        if (!$contact instanceof Contact) {
            $contact = new Contact();
            $contact->setEmail($user->getEmail());
        } else {
            if ($contact->isTrashed()) {
                $contact->untrash();
            }
        }
        $contact->setFirstname($user->getDisplayName());
        $contact->setUserId($user->getId());
        $contact->setTimezone($user->getTimezone());
        $contact->setCompanyId($user->getCompanyId());
        $contact->save();
    } else {
        $contact_id = array_var($user_data, 'contact_id');
        $contact = Contacts::findById($contact_id);
        if ($contact instanceof Contact) {
            // user created from a contact
            $contact->setUserId($user->getId());
            $contact->save();
        } else {
            // if contact with same email exists use it as user's contact, without changing it
            $contact = Contacts::getByEmail($user->getEmail(), true);
            if ($contact instanceof Contact) {
                $contact->setUserId($user->getId());
                if ($contact->isTrashed()) {
                    $contact->untrash();
                }
                $contact->save();
            }
        }
    }
    $contact = $user->getContact();
    if ($contact instanceof Contact) {
        // update contact data with data entered for this user
        $contact->setCompanyId($user->getCompanyId());
//.........这里部分代码省略.........
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:101,代码来源:functions.php

示例14: create_user

function create_user($user_data, $permissionsString, $rp_permissions_data = array(), $save_permissions = true)
{
    // try to find contact by some properties
    $contact_id = array_var($user_data, "contact_id");
    $contact = Contacts::instance()->findById($contact_id);
    if (!is_valid_email(array_var($user_data, 'email'))) {
        throw new Exception(lang("email value is required"));
    }
    if (!$contact instanceof Contact) {
        // Create a new user
        $contact = new Contact();
        $contact->setUsername(array_var($user_data, 'username'));
        $contact->setDisplayName(array_var($user_data, 'display_name'));
        $contact->setCompanyId(array_var($user_data, 'company_id'));
        $contact->setUserType(array_var($user_data, 'type'));
        $contact->setTimezone(array_var($user_data, 'timezone'));
        $contact->setFirstname($contact->getObjectName() != "" ? $contact->getObjectName() : $contact->getUsername());
        $contact->setObjectName();
        $user_from_contact = false;
    } else {
        // Create user from contact
        $contact->setUserType(array_var($user_data, 'type'));
        if (array_var($user_data, 'company_id')) {
            $contact->setCompanyId(array_var($user_data, 'company_id'));
        }
        $contact->setUsername(array_var($user_data, 'username'));
        $contact->setTimezone(array_var($user_data, 'timezone'));
        $user_from_contact = true;
    }
    $contact->save();
    if (is_valid_email(array_var($user_data, 'email'))) {
        $user = Contacts::getByEmail(array_var($user_data, 'email'));
        if (!$user) {
            $contact->addEmail(array_var($user_data, 'email'), 'personal', true);
        }
    }
    //permissions
    $additional_name = "";
    $tmp_pg = PermissionGroups::findOne(array('conditions' => "`name`='User " . $contact->getId() . " Personal'"));
    if ($tmp_pg instanceof PermissionGroup) {
        $additional_name = "_" . gen_id();
    }
    $permission_group = new PermissionGroup();
    $permission_group->setName('User ' . $contact->getId() . $additional_name . ' Personal');
    $permission_group->setContactId($contact->getId());
    $permission_group->setIsContext(false);
    $permission_group->setType("permission_groups");
    $permission_group->save();
    $contact->setPermissionGroupId($permission_group->getId());
    $null = null;
    Hook::fire('on_create_user_perm_group', $permission_group, $null);
    $contact_pg = new ContactPermissionGroup();
    $contact_pg->setContactId($contact->getId());
    $contact_pg->setPermissionGroupId($permission_group->getId());
    $contact_pg->save();
    if (can_manage_security(logged_user())) {
        $sp = new SystemPermission();
        if (!$user_from_contact) {
            $rol_permissions = SystemPermissions::getRolePermissions(array_var($user_data, 'type'));
            if (is_array($rol_permissions)) {
                foreach ($rol_permissions as $pr) {
                    $sp->setPermission($pr);
                }
            }
        }
        $sp->setPermissionGroupId($permission_group->getId());
        if (isset($user_data['can_manage_security'])) {
            $sp->setCanManageSecurity(array_var($user_data, 'can_manage_security'));
        }
        if (isset($user_data['can_manage_configuration'])) {
            $sp->setCanManageConfiguration(array_var($user_data, 'can_manage_configuration'));
        }
        if (isset($user_data['can_manage_templates'])) {
            $sp->setCanManageTemplates(array_var($user_data, 'can_manage_templates'));
        }
        if (isset($user_data['can_manage_time'])) {
            $sp->setCanManageTime(array_var($user_data, 'can_manage_time'));
        }
        if (isset($user_data['can_add_mail_accounts'])) {
            $sp->setCanAddMailAccounts(array_var($user_data, 'can_add_mail_accounts'));
        }
        if (isset($user_data['can_manage_dimensions'])) {
            $sp->setCanManageDimensions(array_var($user_data, 'can_manage_dimensions'));
        }
        if (isset($user_data['can_manage_dimension_members'])) {
            $sp->setCanManageDimensionMembers(array_var($user_data, 'can_manage_dimension_members'));
        }
        if (isset($user_data['can_manage_tasks'])) {
            $sp->setCanManageTasks(array_var($user_data, 'can_manage_tasks'));
        }
        if (isset($user_data['can_task_assignee'])) {
            $sp->setCanTasksAssignee(array_var($user_data, 'can_task_assignee'));
        }
        if (isset($user_data['can_manage_billing'])) {
            $sp->setCanManageBilling(array_var($user_data, 'can_manage_billing'));
        }
        if (isset($user_data['can_view_billing'])) {
            $sp->setCanViewBilling(array_var($user_data, 'can_view_billing'));
        }
        if (isset($user_data['can_see_assigned_to_other_tasks'])) {
//.........这里部分代码省略.........
开发者ID:abhinay100,项目名称:feng_app,代码行数:101,代码来源:functions.php

示例15: count

<tr>
<td height=12></td>
<td rowspan=<?php 
echo count($reportPages) + 2;
?>
 colspan=2 style="background-color:white">

<div style="padding:10px">
<?php 
// MAIN PAGES
$show_help_option = user_config_option('show_context_help');
if ($show_help_option == 'always' || $show_help_option == 'until_close' && user_config_option('show_reporting_panel_context_help', true, logged_user()->getId())) {
    $hd_key = 'chelp reporting panel';
    if (can_manage_reports(logged_user())) {
        $hd_key .= ' manage';
        if (logged_user()->isAdministrator() && can_manage_security(logged_user())) {
            $hd_key .= ' admin';
        }
    }
    render_context_help($this, $hd_key, 'reporting_panel');
    echo '<br/>';
}
foreach ($reportPages as $pageTitle => $pageInfo) {
    ?>
<div class="inner_report_menu_div" id="<?php 
    echo $genid . $pageTitle;
    ?>
" style="display:<?php 
    echo $pageTitle == $selectedPage ? 'block' : 'none';
    ?>
">
开发者ID:pnagaraju25,项目名称:fengoffice,代码行数:31,代码来源:index.php


注:本文中的can_manage_security函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。