本文整理汇总了PHP中ACLRole类的典型用法代码示例。如果您正苦于以下问题:PHP ACLRole类的具体用法?PHP ACLRole怎么用?PHP ACLRole使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ACLRole类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: display
function display()
{
require_once 'modules/ACLRoles/ACLRole.php';
//Get the current user's role
$objACLRole = new ACLRole();
$roles = $objACLRole->getUserRoles($GLOBALS['current_user']->id);
//check if they are in the Admin or Admin Manager's role
if (in_array('Admin', $roles) || in_array('Branch Manager - Delhi', $roles)) {
$this->ev->ss->assign('ReadOnly', '');
} else {
//If not pass in a variable with the value readonly
$this->ev->ss->assign('ReadOnly', 'readonly');
}
//Call the parent display function
parent::display();
}
开发者ID:anmoldeep,项目名称:erp,代码行数:16,代码来源:view.edit.php
示例2: _displaySubPanels
/**
* Override - Called from process(). This method will display subpanels.
* include/MVC/View/SugarView.php
*/
protected function _displaySubPanels()
{
if (isset($this->bean) && !empty($this->bean->id) && (file_exists("modules/" . $this->module . "/metadata/subpaneldefs.php") || file_exists("custom/modules/" . $this->module . "/Ext/Layoutdefs/layoutdefs.ext.php"))) {
$GLOBALS["focus"] = $this->bean;
require_once 'include/SubPanel/SubPanelTiles.php';
$subpanel = new SubPanelTiles($this->bean, $this->module);
//Dependent Logic
global $current_user;
require_once 'modules/ACLRoles/ACLRole.php';
$role = new ACLRole();
$user_id = $current_user->id;
$roles = $role->getUserRoleNames($user_id);
if (in_array("Technical support", $roles)) {
//Subpanels to hide
$hide_subpanels = array("bugs");
if (isset($subpanel->subpanel_definitions->layout_defs['subpanel_setup']["bugs"])) {
unset($subpanel->subpanel_definitions->layout_defs['subpanel_setup']["bugs"]);
}
}
echo $subpanel->display();
}
}
开发者ID:mihir-parikh,项目名称:sugarcrm_playground,代码行数:26,代码来源:view.detail.php
示例3: rebuild_dropdown_filters
/**
* Rebuilds cache files for dropdown filters extension
*/
protected function rebuild_dropdown_filters()
{
$roles = ACLRole::getAllRoles();
foreach ($roles as $role) {
$this->rebuild_role_dropdown_filters($role->id);
}
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:10,代码来源:ModuleInstaller.php
示例4: getRoleUsers
private function getRoleUsers($roleId)
{
require_once 'modules/ACLRoles/ACLRole.php';
$role = new ACLRole();
$role->retrieve($roleId);
$role_users = $role->get_linked_beans('users', 'User');
$r_users = array();
foreach ($role_users as $role_user) {
$r_users[$role_user->id] = $role_user->name;
}
return $r_users;
}
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:12,代码来源:AOPAssignManager.php
示例5: _create_seed_user
/**
* Create a user in the seed data.
*/
function _create_seed_user($id, $last_name, $first_name, $user_name, $title, $is_admin, $reports_to, $reports_to_name, $email)
{
$u = new User();
$u->id = $id;
$u->new_with_id = true;
$u->last_name = $last_name;
$u->first_name = $first_name;
$u->user_name = $user_name;
$u->title = $title;
$u->status = 'Active';
$u->employee_status = 'Active';
$u->is_admin = $is_admin;
$u->is_group = 0;
//$u->user_password = $u->encrypt_password($user_name);
$u->user_hash = User::getPasswordHash($user_name);
$u->reports_to_id = $reports_to;
$u->reports_to_name = $reports_to_name;
//$u->email1 = $email;
$u->emailAddress->addAddress($email, true);
$u->emailAddress->addAddress("reply." . $email, false, true);
$u->emailAddress->addAddress("alias." . $email);
// bug 15371 tyoung set a user preference so that Users/DetailView.php can find something without repeatedly querying the db in vain
$u->setPreference('max_tabs', '7');
$u->savePreferencesToDB();
$u->picture = $this->_copy_user_image($id);
$u->save();
if ($id == "seed_jim_id") {
// add to Sales Administrator Role
$acl_roles = new ACLRole();
$arrRoles = $acl_roles->getAllRoles(true);
foreach ($arrRoles as $role) {
if ($role['name'] == "Sales Administrator") {
$u->load_relationship('aclroles');
$u->aclroles->add($role['id']);
// re-save user manually. otherwise the relation to role set will not be saved
// because One2MBeanRelationship::add() doesn't call SugarRelationship::addToResaveList()
// in workflow and during installation
$u->save();
break;
}
}
}
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:46,代码来源:UserDemoData.php
示例6: getRoles
/**
* Returns object storage containing available roles as keys
* and flags indicating if there is role specific metadata as value
*
* @param callable $callback Callback that checks if there is role specific metadata
* @return SplObjectStorage
*/
public static function getRoles($callback = null)
{
global $current_user;
$roles = new SplObjectStorage();
//Only super user should have access to all roles
$allRoles = $current_user->isAdmin() ? ACLRole::getAllRoles() : ACLRole::getUserRoles($current_user->id, false);
foreach ($allRoles as $role) {
if (in_array($role->name, static::$hiddenRoles)) {
continue;
}
$roles[$role] = $callback ? $callback(array('role' => $role->id)) : null;
}
return $roles;
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:21,代码来源:MBHelper.php
示例7: Sugar_Smarty
global $dictionary;
$sugar_smarty = new Sugar_Smarty();
$sugar_smarty->assign('MOD', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
//nsingh bug: 21669. Messes up localization
/*foreach($modInvisList as $modinvisname){
if(empty($app_list_strings['moduleList'][$modinvisname])){
$app_list_strings['moduleList'][$modinvisname] = $modinvisname;
}
}*/
$sugar_smarty->assign('APP_LIST', $app_list_strings);
/*foreach($modInvisList as $modinvisname){
unset($app_list_strings['moduleList'][$modinvisname]);
}*/
$role = BeanFactory::getBean('ACLRoles', $_REQUEST['record']);
$categories = ACLRole::getRoleActions($_REQUEST['record']);
$names = ACLAction::setupCategoriesMatrix($categories);
// Skipping modules that have 'hidden_to_role_assignment' property
foreach ($categories as $name => $category) {
if (isset($dictionary[$name]) && isset($dictionary[$name]['hidden_to_role_assignment']) && $dictionary[$name]['hidden_to_role_assignment']) {
unset($categories[$name]);
}
}
$categories2 = array();
$categories2 = $categories;
$hidden_categories = array("KBDocuments", "Campaigns", "Forecasts", "Emails", "EmailTemplates", "EmailMarketing", "Reports", "PdfManager");
foreach ($hidden_categories as $v) {
if (isset($categories2[$v])) {
unset($categories2[$v]);
}
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:31,代码来源:DetailView.php
示例8: getEmailsFromParams
private function getEmailsFromParams(SugarBean $bean, $params)
{
$emails = array();
//backward compatible
if (isset($params['email_target_type']) && !is_array($params['email_target_type'])) {
$email = '';
switch ($params['email_target_type']) {
case 'Email Address':
$params['email'] = array($params['email']);
break;
case 'Specify User':
$params['email'] = array($params['email_user_id']);
break;
case 'Related Field':
$params['email'] = array($params['email_target']);
break;
}
$params['email_target_type'] = array($params['email_target_type']);
$params['email_to_type'] = array('to');
}
//end backward compatible
if (isset($params['email_target_type'])) {
foreach ($params['email_target_type'] as $key => $field) {
switch ($field) {
case 'Email Address':
if (trim($params['email'][$key]) != '') {
$emails[$params['email_to_type'][$key]][] = $params['email'][$key];
}
break;
case 'Specify User':
$user = new User();
$user->retrieve($params['email'][$key]);
$user_email = $user->emailAddress->getPrimaryAddress($user);
if (trim($user_email) != '') {
$emails[$params['email_to_type'][$key]][] = $user_email;
$emails['template_override'][$user_email] = array('Users' => $user->id);
}
break;
case 'Users':
$users = array();
switch ($params['email'][$key][0]) {
case 'security_group':
if (file_exists('modules/SecurityGroups/SecurityGroup.php')) {
require_once 'modules/SecurityGroups/SecurityGroup.php';
$security_group = new SecurityGroup();
$security_group->retrieve($params['email'][$key][1]);
$users = $security_group->get_linked_beans('users', 'User');
$r_users = array();
if ($params['email'][$key][2] != '') {
require_once 'modules/ACLRoles/ACLRole.php';
$role = new ACLRole();
$role->retrieve($params['email'][$key][2]);
$role_users = $role->get_linked_beans('users', 'User');
foreach ($role_users as $role_user) {
$r_users[$role_user->id] = $role_user->name;
}
}
foreach ($users as $user_id => $user) {
if ($params['email'][$key][2] != '' && !isset($r_users[$user->id])) {
unset($users[$user_id]);
}
}
break;
}
//No Security Group module found - fall through.
//No Security Group module found - fall through.
case 'role':
require_once 'modules/ACLRoles/ACLRole.php';
$role = new ACLRole();
$role->retrieve($params['email'][$key][2]);
$users = $role->get_linked_beans('users', 'User');
break;
case 'all':
default:
global $db;
$sql = "SELECT id from users WHERE status='Active' AND portal_only=0 ";
$result = $db->query($sql);
while ($row = $db->fetchByAssoc($result)) {
$user = new User();
$user->retrieve($row['id']);
$users[$user->id] = $user;
}
break;
}
foreach ($users as $user) {
$user_email = $user->emailAddress->getPrimaryAddress($user);
if (trim($user_email) != '') {
$emails[$params['email_to_type'][$key]][] = $user_email;
$emails['template_override'][$user_email] = array('Users' => $user->id);
}
}
break;
case 'Related Field':
$emailTarget = $params['email'][$key];
$relatedFields = array_merge($bean->get_related_fields(), $bean->get_linked_fields());
$field = $relatedFields[$emailTarget];
if ($field['type'] == 'relate') {
$linkedBeans = array();
$idName = $field['id_name'];
$id = $bean->{$idName};
//.........这里部分代码省略.........
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:101,代码来源:actionSendEmail.php
示例9: foreach
$aclrole->setAction($aclrole->id, $action['id'], ACL_ALLOW_NONE);
}
echo 'Only owner Peon user should have editaccess to contacts<br>';
$aclrole->setAction($aclrole->id, $action_results['Contacts']['edit']['id'], ACL_ALLOW_OWNER);
echo 'Some one made a mistake and added delete access on Contacts<br>';
$aclrole->setAction($aclrole->id, $action_results['Contacts']['delete']['id'], ACL_ALLOW_ALL);
$action_results = ACLAction::getUserActions('will_id', true);
echo 'Actions Peon role for will<br>';
foreach ($action_results as $category_name => $category) {
foreach ($category as $action_name => $action) {
_pp($category_name . ':' . $action_name . ':' . acl_translate($action['access']));
}
}
echo 'Will is a bad peon user<br>';
echo 'Create a role for Bad Peon Users<br>';
$aclrole = new ACLRole();
$aclrole->name = 'Bad Peon User';
$aclrole->description = 'The Bad Peon Role For All Bad Peons';
$aclrole->user_id = 'will_id';
$aclrole->save();
echo 'No Bad Peon user should have access to contacts <br>';
foreach ($action_results['Contacts'] as $action) {
$aclrole->setAction($aclrole->id, $action['id'], ACL_ALLOW_NONE);
}
$action_results = ACLAction::getUserActions('will_id', true);
echo 'Actions Peon role for will<br>';
foreach ($action_results as $category_name => $category) {
foreach ($category as $action_name => $action) {
_pp($category_name . ':' . $action_name . ':' . acl_translate($action['access']));
}
}
开发者ID:BackupTheBerlios,项目名称:livealphaprint,代码行数:31,代码来源:test_actions.php
示例10: setCookie
//set cookies
if (isset($_SESSION['authenticated_user_id'])) {
setCookie('ck_login_id_20', $_SESSION['authenticated_user_id'], time() + 86400 * 90);
}
if (isset($_SESSION['authenticated_user_theme'])) {
setCookie('ck_login_theme_20', $_SESSION['authenticated_user_theme'], time() + 86400 * 90);
}
if (isset($_SESSION['authenticated_user_theme_color'])) {
setCookie('ck_login_theme_color_20', $_SESSION['authenticated_user_theme_color'], time() + 86400 * 90);
}
if (isset($_SESSION['authenticated_user_theme_font'])) {
setCookie('ck_login_theme_font_20', $_SESSION['authenticated_user_theme_font'], time() + 86400 * 90);
}
if (isset($_SESSION['authenticated_user_language'])) {
setCookie('ck_login_language_20', $_SESSION['authenticated_user_language'], time() + 86400 * 90);
}
require_once 'modules/ACLRoles/ACLRole.php';
$objACLRole = new ACLRole();
$roles = $objACLRole->getUserRoles($GLOBALS['current_user']->id);
if (in_array('Lawyer', $roles)) {
print "<h2>You do not have permissions to access this function.</h2>";
exit;
}
chdir($current_directory);
$_POST = $post;
$_GET = $get;
/*foreach(array_keys($GLOBALS) as $key) {
if (!in_array($key, array('_GET', '_POST', '_COOKIE', '_FILES', '_SERVER', '_REQUEST', 'GLOBALS'))) {
unset($GLOBALS[$key]);
}
}*/
开发者ID:BMLP,项目名称:memoryhole-ansible,代码行数:31,代码来源:thirdpartyauth.php
示例11: quick_edit_case_updates
/**
* The Quick edit for case updates which appears under update stream
* Also includes the javascript for AJAX update
*
* @return string - the html to be displayed and javascript
*/
function quick_edit_case_updates()
{
//current record id
$record = $_GET['record'];
//Get Users roles
require_once 'modules/ACLRoles/ACLRole.php';
$user = $GLOBALS['current_user'];
$id = $user->id;
$acl = new ACLRole();
$roles = $acl->getUserRoles($id);
//Return if user cannot edit cases
if (in_array("no edit cases", $roles) || $roles === "no edit cases") {
return;
}
//Javascript for Asynchronous update
$javascript = <<<A
<script>
function caseUpdates(){
loadingMessgPanl = new YAHOO.widget.SimpleDialog('loading', {
width: '200px',
close: true,
modal: true,
visible: true,
fixedcenter: true,
constraintoviewport: true,
draggable: false
});
loadingMessgPanl.setHeader(SUGAR.language.get('app_strings', 'LBL_EMAIL_PERFORMING_TASK'));
loadingMessgPanl.setBody(SUGAR.language.get('app_strings', 'LBL_EMAIL_ONE_MOMENT'));
loadingMessgPanl.render(document.body);
loadingMessgPanl.show();
var update_data = document.getElementById('update_text').value;
var checkbox = document.getElementById('internal').checked;
var internal = "";
if(checkbox){
internal=1;
}
//Post parameters
var params =
"record={$record}&module=Cases&return_module=Cases&action=Save&return_id={$record}&return_action=DetailView&relate_to=Cases&relate_id={$record}&offset=1&update_text="
+ update_data + "&internal=" + internal;
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", "index.php", true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.setRequestHeader("Content-length", params.length);
xmlhttp.setRequestHeader("Connection", "close");
//When button is clicked
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
showSubPanel('history', null, true);
//Reload the case updates stream and history panels
\t\t \$("#LBL_AOP_CASE_UPDATES").load("index.php?module=Cases&action=DetailView&record={$record}" + " #LBL_AOP_CASE_UPDATES", function(){
//Collapse all except newest update
\$('.caseUpdateImage').attr("src",showUpdateImage);
\$('.caseUpdate').slideUp('fast');
var id = \$('.caseUpdate').last().attr('id');
if(id){
toggleCaseUpdate(id.replace('caseUpdate',''));
}
loadingMessgPanl.hide();
}
);
\t}
}
xmlhttp.send(params);
}
</script>
A;
$html = <<<EOD
<form id='case_updates' enctype="multipart/form-data">
<textarea id="update_text" name="update_text" cols="80" rows="4"></textarea>
//.........这里部分代码省略.........
开发者ID:pikkoui,项目名称:suitecrm,代码行数:101,代码来源:Case_Updates.php
示例12: Sugar_Smarty
* "Powered by SugarCRM".
********************************************************************************/
global $app_list_strings;
// $modInvisList
$sugar_smarty = new Sugar_Smarty();
$sugar_smarty->assign('MOD', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
//mass localization
/*foreach($modInvisList as $modinvisname){
$app_list_strings['moduleList'][$modinvisname] = $modinvisname;
}*/
$sugar_smarty->assign('APP_LIST', $app_list_strings);
/*foreach($modInvisList as $modinvisname){
unset($app_list_strings['moduleList'][$modinvisname]);
}*/
$role = new ACLRole();
$role_name = '';
$return = array('module' => 'ACLRoles', 'action' => 'index', 'record' => '');
if (!empty($_REQUEST['record'])) {
$role->retrieve($_REQUEST['record']);
$categories = ACLRole::getRoleActions($_REQUEST['record']);
$role_name = $role->name;
if (!empty($_REQUEST['isDuplicate'])) {
//role id is stripped here in duplicate so anything using role id after this will not have it
$role->id = '';
} else {
$return['record'] = $role->id;
$return['action'] = 'DetailView';
}
} else {
$categories = ACLRole::getRoleActions('');
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:31,代码来源:EditRole.php
示例13: addDefaultRoles
function addDefaultRoles($defaultRoles = array())
{
global $db;
foreach ($defaultRoles as $roleName => $role) {
$ACLField = new ACLField();
$role1 = new ACLRole();
$role1->name = $roleName;
$role1->description = $roleName . " Role";
$role1_id = $role1->save();
foreach ($role as $category => $actions) {
foreach ($actions as $name => $access_override) {
if ($name == 'fields') {
foreach ($access_override as $field_id => $access) {
$ACLField->setAccessControl($category, $role1_id, $field_id, $access);
}
} else {
$queryACL = "SELECT id FROM acl_actions where category='{$category}' and name='{$name}'";
$result = $db->query($queryACL);
$actionId = $db->fetchByAssoc($result);
if (isset($actionId['id']) && !empty($actionId['id'])) {
$role1->setAction($role1_id, $actionId['id'], $access_override);
}
}
}
}
}
}
开发者ID:stefano6310,项目名称:SuiteCRM,代码行数:27,代码来源:install_utils.php
示例14: set_record
function set_record(SugarBean $record, SugarBean $bean, $params = array(), $in_save = false)
{
global $app_list_strings, $timedate;
$record_vardefs = $record->getFieldDefinitions();
if (isset($params['field'])) {
foreach ($params['field'] as $key => $field) {
if ($field == '') {
continue;
}
switch ($params['value_type'][$key]) {
case 'Field':
if ($params['value'][$key] == '') {
continue;
}
$data = $bean->field_defs[$params['value'][$key]];
if ($data['type'] == 'relate' && isset($data['id_name'])) {
$params['value'][$key] = $data['id_name'];
}
$value = $bean->{$params}['value'][$key];
break;
case 'Date':
$dformat = 'Y-m-d H:i:s';
if ($record_vardefs[$field]['type'] == 'date') {
$dformat = 'Y-m-d';
}
switch ($params['value'][$key][3]) {
case 'business_hours':
if (file_exists('modules/AOBH_BusinessHours/AOBH_BusinessHours.php')) {
require_once 'modules/AOBH_BusinessHours/AOBH_BusinessHours.php';
$businessHours = new AOBH_BusinessHours();
$dateToUse = $params['value'][$key][0];
$sign = $params['value'][$key][1];
$amount = $params['value'][$key][2];
if ($sign != "plus") {
$amount = 0 - $amount;
}
if ($dateToUse == "now") {
$value = $businessHours->addBusinessHours($amount);
} else {
if ($dateToUse == "field") {
$dateToUse = $params['field'][$key];
$value = $businessHours->addBusinessHours($amount, $timedate->fromDb($bean->{$dateToUse}));
} else {
$value = $businessHours->addBusinessHours($amount, $timedate->fromDb($bean->{$dateToUse}));
}
}
$value = $timedate->asDb($value);
break;
}
$params['value'][$key][3] = 'hours';
//No business hours module found - fall through.
//No business hours module found - fall through.
default:
if ($params['value'][$key][0] == 'now') {
$date = gmdate($dformat);
} else {
if ($params['value'][$key][0] == 'field') {
$date = $record->fetched_row[$params['field'][$key]];
} else {
$date = $bean->fetched_row[$params['value'][$key][0]];
}
}
if ($params['value'][$key][1] != 'now') {
$value = date($dformat, strtotime($date . ' ' . $app_list_strings['aow_date_operator'][$params['value'][$key][1]] . $params['value'][$key][2] . ' ' . $params['value'][$key][3]));
} else {
$value = date($dformat, strtotime($date));
}
break;
}
break;
case 'Round_Robin':
case 'Least_Busy':
case 'Random':
switch ($params['value'][$key][0]) {
case 'security_group':
if (file_exists('modules/SecurityGroups/SecurityGroup.php')) {
require_once 'modules/SecurityGroups/SecurityGroup.php';
$security_group = new SecurityGroup();
$security_group->retrieve($params['value'][$key][1]);
$group_users = $security_group->get_linked_beans('users', 'User');
$users = array();
$r_users = array();
if ($params['value'][$key][2] != '') {
require_once 'modules/ACLRoles/ACLRole.php';
$role = new ACLRole();
$role->retrieve($params['value'][$key][2]);
$role_users = $role->get_linked_beans('users', 'User');
foreach ($role_users as $role_user) {
$r_users[$role_user->id] = $role_user->name;
}
}
foreach ($group_users as $group_user) {
if ($params['value'][$key][2] != '' && !isset($r_users[$group_user->id])) {
continue;
}
$users[$group_user->id] = $group_user->name;
}
break;
}
//No Security Group module found - fall through.
//.........这里部分代码省略.........
开发者ID:omusico,项目名称:windcrm,代码行数:101,代码来源:actionCreateRecord.php
示例15: NotifySalesManagers
function NotifySalesManagers($bean)
{
global $sugar_config;
$amount_limit = 1000;
if ($bean->sales_stage === "Negotiation/Review" && $bean->fetched_row['sales_stage'] === "Proposal/Price Quote" && $bean->amount >= $amount_limit) {
SugarApplication::appendErrorMessage('You have changed the opportunity ' . $bean->name . ' (greater than ' . $amount_limit . ') to Negotiation/Review.');
$emailsTo = array();
$emailSubject = "Opportunity Alert";
$emailBody = "The Opportunity " . $bean->name . " has changed to Negotiation/Review<br />\n\t\t\tYou can see the opportunity here:<br />\n\t\t\t<a href=\"" . $sugar_config['site_url'] . "/index.php?module=Opportunities&action=DetailView&record=" . $bean->id . "\">" . $bean->name . "</a>";
$role_id = "<sales-manager-role-id>";
$aclrole = new ACLRole();
if (!is_null($aclrole->retrieve($role_id))) {
$users = $aclrole->get_linked_beans('users', 'User');
foreach ($users as $user) {
$emailsTo[] = $user->email1;
}
}
$this->SendEmail($emailsTo, $emailSubject, $emailBody);
}
}
开发者ID:julieth756,项目名称:SugarCRMLogicHooks,代码行数:20,代码来源:OpportunitiesHooks.php
示例16: ACLRole
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address [email protected].
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$role = new ACLRole();
if (isset($_REQUEST['record'])) {
$role->mark_deleted($_REQUEST['record']);
}
require_once 'include/formbase.php';
handleRedirect();
开发者ID:omusico,项目名称:sugar_work,代码行数:31,代码来源:Delete.php
示例17: array
$role = BeanFactory::getBean('ACLRoles');
$role_name = '';
$return = array('module' => 'ACLRoles', 'action' => 'index', 'record' => '');
if (!empty($_REQUEST['record'])) {
$role->retrieve($_REQUEST['record']);
$categories = ACLRole::getRoleActions($_REQUEST['record']);
$role_name = $role->name;
if (!empty($_REQUEST['isDuplicate'])) {
//role id is stripped here in duplicate so anything using role id after this will not have it
$role->id = '';
} else {
$return['record'] = $role->id;
$return['action'] = 'DetailView';
}
} else {
$categories = ACLRole::getRoleActions('');
}
// Skipping modules that have 'hidden_to_role_assignment' property
foreach ($categories as $name => $category) {
if (isset($dictionary[$name]) && isset($dictionary[$name]['hidden_to_role_assignment']) && $dictionary[$name]['hidden_to_role_assignment']) {
unset($categories[$name]);
}
}
if (in_array('Project', $modInvisList)) {
unset($categories['Project']);
unset($categories['ProjectTask']);
}
$sugar_smarty->assign('ROLE', $role->toArray());
$tdwidth = 10;
if (isset($_REQUEST['return_module'])) {
$return['module'] = $_REQUEST['return_module'];
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:31,代码来源:EditRole.php
示例18: quick_edit_case_updates
/**
* The Quick edit for case updates which appears under update stream
* Also includes the javascript for AJAX update
*
* @return string - the html to be displayed and javascript
*/
function quick_edit_case_updates()
{
global $action;
//on DetailView only
if ($action != 'DetailView') {
return;
}
//current record id
$record = $_GET['record'];
//Get Users roles
require_once 'modules/ACLRoles/ACLRole.php';
$user = $GLOBALS['current_user'];
$id = $user->id;
$acl = new ACLRole();
$roles = $acl->getUserRoles($id);
//Return if user cannot edit cases
if (in_array("no edit cases", $roles) || $roles === "no edit cases") {
return;
}
$html = <<<EOD
<form id='case_updates' enctype="multipart/form-data">
<textarea id="update_text" name="update_text" cols="80" rows="4"></textarea>
<input id='internal' type='checkbox' name='internal' tabindex=0 title='' value='1'> Internal</input>
</br>
<input type='button' value='Save' onclick="caseUpdates('{$record}')" title="Save" name="button"> </input>
</br>
</form>
EOD;
return $html;
}
开发者ID:switcode,项目名称:SuiteCRM,代码行数:43,代码来源:Case_Updates.php
示例19: getUserData
/**
* Returns all the user data to be sent in the REST API call for a normal
* `/me` call.
*
* This data is dependent on the platform used. Each own platform has a
* different data set to be sent in the response.
*
* @param string $platform The platform of the request.
* @param array $options A list of options like `category` to retrieve the
* basic user info. Will use `global` if no `category` is supplied.
* @return array The user's data to be used in a `/me` request.
*/
protected function getUserData($platform, array $options)
{
$current_user = $this->getUserBean();
// Get the basics
$category = isset($options['category']) ? $options['category'] : 'global';
$user_data = $this->getBasicUserInfo($platform, $category);
// Fill in the rest
$user_data['type'] = self::TYPE_USER;
if ($current_user->isAdmin()) {
$user_data['type'] = self::TYPE_ADMIN;
}
$user_data['show_wizard'] = $this->shouldShowWizard($category);
$user_data['id'] = $current_user->id;
$current_user->_create_proper_name_field();
$user_data['full_name'] = $current_user->full_name;
$user_data['user_name'] = $current_user->user_name;
$user_data['roles'] = ACLRole::getUserRoles($current_user->id);
$user_data = $this->setExpiredPassword($user_data);
$user_data['picture'] = $current_user->picture;
$user_data['acl'] = $this->getAcls($platform);
$user_data['is_manager'] = User::isManager($current_user->id);
$user_data['is_top_level_manager'] = false;
$user_data['reports_to_id'] = $current_user->reports_to_id;
$user_data['reports_to_name'] = $current_user->reports_to_name;
if ($user_data['is_manager']) {
$user_data['is_top_level_manager'] = User::isTopLevelManager($current_user->id);
}
// Address information
$user_data['address_street'] = $current_user->address_street;
$user_data['address_city'] = $current_user->address_city;
$user_data['address_state'] = $current_user->address_state;
$user_data['address_country'] = $current_user->address_country;
$user_data['address_postalcode'] = $current_user->address_postalcode;
require_once 'modules/Teams/TeamSetManager.php';
$teams = $current_user->get_my_teams();
$my_teams = array();
foreach ($teams as $id => $name) {
$my_teams[] = array('id' => $id, 'name' => $name);
}
$user_data['my_teams'] = $my_teams;
$defaultTeams = TeamSetManager::getTeamsFromSet($current_user->team_set_id);
foreach ($defaultTeams as $id => $team) {
$defaultTeams[$id]['primary'] = false;
if ($team['id'] == $current_user->team_id) {
$defaultTeams[$id]['primary'] = true;
}
}
$user_data['preferences']['default_teams'] = $defaultTeams;
// Send back a hash of this data for use by the client
$user_data['_hash'] = $current_user->getUserMDHash();
return array('current_user' => $user_data);
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:64,代码来源:CurrentUserApi.php
示例20: getUserRoles
/**
* Returns user's ACL roles
*
* @param User $user
* @return ACLRole[]
*/
protected function getUserRoles(User $user)
{
return ACLRole::getUserRoles($user->id, false);
}
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:10,代码来源:AclRoleSetRegistrar.php
注:本文中的ACLRole类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论