Add php files

This commit is contained in:
2025-05-12 15:44:39 +00:00
parent c951760058
commit 82d5804ac4
9534 changed files with 2638137 additions and 0 deletions

274
modules/ACLRoles/ACLRole.php Executable file
View File

@@ -0,0 +1,274 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
class ACLRole extends SugarBean{
var $module_dir = 'ACLRoles';
var $object_name = 'ACLRole';
var $table_name = 'acl_roles';
var $new_schema = true;
var $disable_row_level_security = true;
var $relationship_fields = array(
'user_id'=>'users'
);
var $created_by;
function ACLRole(){
parent::SugarBean();
}
// bug 16790 - missing get_summary_text method led Tracker to display SugarBean's "base implementation"
function get_summary_text()
{
return "$this->name";
}
/**
* function setAction($role_id, $action_id, $access)
*
* Sets the relationship between a role and an action and sets the access level of that relationship
*
* @param GUID $role_id - the role id
* @param GUID $action_id - the ACL Action id
* @param int $access - the access level ACL_ALLOW_ALL ACL_ALLOW_NONE ACL_ALLOW_OWNER...
*/
function setAction($role_id, $action_id, $access){
$relationship_data = array('role_id'=>$role_id, 'action_id'=>$action_id,);
$additional_data = array('access_override'=>$access);
$this->set_relationship('acl_roles_actions',$relationship_data,true, true,$additional_data);
}
/**
* static getUserRoles($user_id)
* returns a list of ACLRoles for a given user id
*
* @param GUID $user_id
* @return a list of ACLRole objects
*/
function getUserRoles($user_id, $getAsNameArray = true){
//if we don't have it loaded then lets check against the db
$additional_where = '';
$query = "SELECT acl_roles.* ".
"FROM acl_roles ".
"INNER JOIN acl_roles_users ON acl_roles_users.user_id = '$user_id' ".
"AND acl_roles_users.role_id = acl_roles.id AND acl_roles_users.deleted = 0 ".
"WHERE acl_roles.deleted=0 ";
$result = $GLOBALS['db']->query($query);
$user_roles = array();
while($row = $GLOBALS['db']->fetchByAssoc($result) ){
$role = new ACLRole();
$role->populateFromRow($row);
if($getAsNameArray)
$user_roles[] = $role->name;
else
$user_roles[] = $role;
}
return $user_roles;
}
/**
* static getUserRoleNames($user_id)
* returns a list of Role names for a given user id
*
* @param GUID $user_id
* @return a list of ACLRole Names
*/
function getUserRoleNames($user_id){
$user_roles = sugar_cache_retrieve("RoleMembershipNames_".$user_id);
if(!$user_roles){
//if we don't have it loaded then lets check against the db
$additional_where = '';
$query = "SELECT acl_roles.* ".
"FROM acl_roles ".
"INNER JOIN acl_roles_users ON acl_roles_users.user_id = '$user_id' ".
"AND acl_roles_users.role_id = acl_roles.id AND acl_roles_users.deleted = 0 ".
"WHERE acl_roles.deleted=0 ";
$result = $GLOBALS['db']->query($query);
$user_roles = array();
while($row = $GLOBALS['db']->fetchByAssoc($result) ){
$user_roles[] = $row['name'];
}
sugar_cache_put("RoleMembershipNames_".$user_id, $user_roles);
}
return $user_roles;
}
/**
* static getAllRoles($returnAsArray = false)
*
* @param boolean $returnAsArray - should it return the results as an array of arrays or as an array of ACLRoles
* @return either an array of array representations of acl roles or an array of ACLRoles
*/
function getAllRoles($returnAsArray = false){
$db = DBManagerFactory::getInstance();
$query = "SELECT acl_roles.* FROM acl_roles
WHERE acl_roles.deleted=0 ORDER BY name";
$result = $db->query($query);
$roles = array();
while($row = $db->fetchByAssoc($result) ){
$role = new ACLRole();
$role->populateFromRow($row);
if($returnAsArray){
$roles[] = $role->toArray();
}else{
$roles[] = $role;
}
}
return $roles;
}
/**
* static getRoleActions($role_id)
*
* gets the actions of a given role
*
* @param GUID $role_id
* @return array of actions
*/
function getRoleActions($role_id, $type='module'){
global $beanList;
//if we don't have it loaded then lets check against the db
$additional_where = '';
$db = DBManagerFactory::getInstance();
$query = "SELECT acl_actions.*";
//only if we have a role id do we need to join the table otherwise lets use the ones defined in acl_actions as the defaults
if(!empty($role_id)){
$query .=" ,acl_roles_actions.access_override ";
}
$query .=" FROM acl_actions ";
if(!empty($role_id)){
$query .= " LEFT JOIN acl_roles_actions ON acl_roles_actions.role_id = '$role_id' AND acl_roles_actions.action_id = acl_actions.id AND acl_roles_actions.deleted = 0";
}
$query .= " WHERE acl_actions.deleted=0 ORDER BY acl_actions.category, acl_actions.name";
$result = $db->query($query);
$role_actions = array();
while($row = $db->fetchByAssoc($result) ){
$action = new ACLAction();
$action->populateFromRow($row);
if(!empty($row['access_override'])){
$action->aclaccess = $row['access_override'];
}else{
$action->aclaccess = ACL_ALLOW_DEFAULT;
}
//#27877 . If there is no this module in beanlist , we will not show them in UI, no matter this module was deleted or not in ACL_ACTIONS table.
if(empty($beanList[$action->category])){
continue;
}
//end
if(!isset($role_actions[$action->category])){
$role_actions[$action->category] = array();
}
$role_actions[$action->category][$action->acltype][$action->name] = $action->toArray();
}
return $role_actions;
}
/**
* function mark_relationships_deleted($id)
*
* special case to delete acl_roles_actions relationship
*
* @param ACLRole GUID $id
*/
function mark_relationships_deleted($id){
//we need to delete the actions relationship by hand (special case)
$date_modified = db_convert("'".gmdate($GLOBALS['timedate']->get_db_date_time_format())."'", 'datetime');
$query = "UPDATE acl_roles_actions SET deleted=1 , date_modified=$date_modified WHERE role_id = '$id' AND deleted=0";
$this->db->query($query);
parent::mark_relationships_deleted($id);
}
/**
* toArray()
* returns this role as an array
*
* @return array of fields with id, name, description
*/
function toArray(){
$array_fields = array('id', 'name', 'description');
$arr = array();
foreach($array_fields as $field){
if(isset($this->$field)){
$arr[$field] = $this->$field;
}else{
$arr[$field] = '';
}
}
return $arr;
}
/**
* fromArray($arr)
* converts an array into an role mapping name value pairs into files
*
* @param Array $arr
*/
function fromArray($arr){
foreach($arr as $name=>$value){
$this->$name = $value;
}
}
}
?>

45
modules/ACLRoles/Delete.php Executable file
View File

@@ -0,0 +1,45 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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();
?>

View File

@@ -0,0 +1,91 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
global $app_list_strings, $app_strings, $current_user;
$mod_strings = return_module_language($GLOBALS['current_language'], 'Users');
$focus = new User();
$focus->retrieve($_REQUEST['record']);
$sugar_smarty = new Sugar_Smarty();
$sugar_smarty->assign('MOD', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
$sugar_smarty->assign('APP_LIST', $app_list_strings);
$categories = ACLAction::getUserActions($_REQUEST['record'],true);
//clear out any removed tabs from user display
if(!is_admin($current_user)&& !is_admin_for_module($GLOBALS['current_user'],'Users')){
$tabs = $focus->getPreference('display_tabs');
global $modInvisList, $modInvisListActivities;
if(!empty($tabs)){
foreach($categories as $key=>$value){
if(!in_array($key, $tabs) && !in_array($key, $modInvisList) && !in_array($key, $modInvisListActivities) ){
unset($categories[$key]);
}
}
}
}
$names = array();
$names = ACLAction::setupCategoriesMatrix($categories);
if(!empty($names))$tdwidth = 100 / sizeof($names);
$sugar_smarty->assign('APP', $app_list_strings);
$sugar_smarty->assign('CATEGORIES', $categories);
$sugar_smarty->assign('TDWIDTH', $tdwidth);
$sugar_smarty->assign('ACTION_NAMES', $names);
$title = get_module_title( '',$mod_strings['LBL_ROLES_SUBPANEL_TITLE'], '');
$sugar_smarty->assign('TITLE', $title);
$sugar_smarty->assign('USER_ID', $focus->id);
$sugar_smarty->assign('LAYOUT_DEF_KEY', 'UserRoles');
echo $sugar_smarty->fetch('modules/ACLRoles/DetailViewUser.tpl');
//this gets its layout_defs.php file from the user not from ACLRoles so look in modules/Users for the layout defs
require_once('include/SubPanel/SubPanelTiles.php');
$modules_exempt_from_availability_check=array('Users'=>'Users','ACLRoles'=>'ACLRoles',);
$subpanel = new SubPanelTiles($focus, 'UserRoles');
echo $subpanel->display(true,true);

98
modules/ACLRoles/DetailView.php Executable file
View File

@@ -0,0 +1,98 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
//global $modInvisList;
$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 = new ACLRole();
$role->retrieve($_REQUEST['record']);
$categories = ACLRole::getRoleActions($_REQUEST['record']);
$names = ACLAction::setupCategoriesMatrix($categories);
$categories2 = array();
$categories2=$categories;
$hidden_categories = array(
"KBDocuments", "Campaigns","Forecasts","ForecastSchedule",
"Emails","EmailTemplates","EmailMarketing","Reports");
foreach($hidden_categories as $v){
if (isset($categories2[$v])) {
unset($categories2[$v]);
}
}
if(!empty($names))$tdwidth = 100 / sizeof($names);
$sugar_smarty->assign('ROLE', $role->toArray());
$sugar_smarty->assign('CATEGORIES', $categories);
$sugar_smarty->assign('CATEGORIES2', $categories2);
$sugar_smarty->assign('TDWIDTH', $tdwidth);
$sugar_smarty->assign('ACTION_NAMES', $names);
$return= array('module'=>'ACLRoles', 'action'=>'DetailView', 'record'=>$role->id);
$sugar_smarty->assign('RETURN', $return);
$params = array();
$params[] = "<a href='index.php?module=ACLRoles&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>";
$params[] = $role->get_summary_text();
echo getClassicModuleTitle("ACLRoles", $params, true);
//$sugar_smarty->assign('TITLE', $title);
$hide_hide_supanels = true;
echo $sugar_smarty->fetch('modules/ACLRoles/DetailView.tpl');
//for subpanels the variable must be named focus;
$focus =& $role;
$_REQUEST['module'] = 'ACLRoles';
require_once('include/SubPanel/SubPanelTiles.php');
$subpanel = new SubPanelTiles($role, 'ACLRoles');
echo $subpanel->display();
?>

102
modules/ACLRoles/EditRole.php Executable file
View File

@@ -0,0 +1,102 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
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('');
}
$sugar_smarty->assign('ROLE', $role->toArray());
$tdwidth = 10;
if(isset($_REQUEST['return_module'])){
$return['module']=$_REQUEST['return_module'];
if(isset($_REQUEST['return_action']))$return['action']=$_REQUEST['return_action'];
if(isset($_REQUEST['return_record']))$return['record']=$_REQUEST['return_record'];
}
$sugar_smarty->assign('RETURN', $return);
$names = ACLAction::setupCategoriesMatrix($categories);
if(!empty($names))$tdwidth = 100 / sizeof($names);
$sugar_smarty->assign('CATEGORIES', $categories);
$sugar_smarty->assign('CATEGORY_NAME', $_REQUEST['category_name']);
$sugar_smarty->assign('TDWIDTH', $tdwidth);
$sugar_smarty->assign('ACTION_NAMES', $names);
$actions = $categories[$_REQUEST['category_name']]['module'];
$sugar_smarty->assign('ACTIONS', $actions);
ob_clean();
if($_REQUEST['category_name'] == 'All'){
echo $sugar_smarty->fetch('modules/ACLRoles/EditAllBody.tpl');
}else{
//WDong Bug 23195: Strings not localized in Role Management.
echo get_module_title($_REQUEST['category_name'],$app_list_strings['moduleList'][$_REQUEST['category_name']], false);
echo $sugar_smarty->fetch('modules/ACLRoles/EditRole.tpl');
echo '</form>';
}
sugar_cleanup(true);

107
modules/ACLRoles/EditView.php Executable file
View File

@@ -0,0 +1,107 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
global $app_list_strings;// $modInvisList;
$sugar_smarty = new Sugar_Smarty();
$sugar_smarty->assign('MOD', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
$sugar_smarty->assign('ISDUPLICATE', '');
$duplicateString='';
//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 = '';
$sugar_smarty->assign('ISDUPLICATE', $_REQUEST['record']);
$duplicateString=translate('LBL_DUPLICATE_OF', 'ACLRoles');
}else{
$return['record']= $role->id;
$return['action']='DetailView';
}
}else{
$categories = ACLRole::getRoleActions('');
}
$sugar_smarty->assign('ROLE', $role->toArray());
$tdwidth = 10;
if(isset($_REQUEST['return_module'])){
$return['module']=$_REQUEST['return_module'];
if(isset($_REQUEST['return_id']))$return['record']=$_REQUEST['return_id'];
if(isset($_REQUEST['return_record'])){$return['record']=$_REQUEST['return_record'];}
if(isset($_REQUEST['return_action'])){$return['action']=$_REQUEST['return_action'];}
if ( !empty($return['record']) ) {
$return['action'] = 'DetailView';
}
}
$sugar_smarty->assign('RETURN', $return);
$names = ACLAction::setupCategoriesMatrix($categories);
$sugar_smarty->assign('CATEGORIES', $categories);
$sugar_smarty->assign('TDWIDTH', $tdwidth);
$sugar_smarty->assign('ACTION_NAMES', $names);
$params = array();
$params[] = "<a href='index.php?module=ACLRoles&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>";
if(empty($role->id)){
$params[] = $GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL'];
}else{
$params[] = "<a href='index.php?module=ACLRoles&action=DetailView&record={$role->id}'>".$role->get_summary_text()."</a>";
$params[] = $GLOBALS['app_strings']['LBL_EDIT_BUTTON_LABEL'];
}
echo getClassicModuleTitle("ACLRoles", $params, true);
echo $sugar_smarty->fetch('modules/ACLRoles/EditView.tpl');
?>

0
modules/ACLRoles/Forms.php Executable file
View File

70
modules/ACLRoles/ListUsers.php Executable file
View File

@@ -0,0 +1,70 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
if(!is_admin($current_user)&&!is_admin_for_module($GLOBALS['current_user'],'Users')){
sugar_die('No Access');
}
$record = '';
if(isset($_REQUEST['record'])) $record = $_REQUEST['record'];
?>
<form action="index.php" method="post" name="DetailView" id="form">
<input type="hidden" name="module" value="Users">
<input type="hidden" name="user_id" value="">
<input type="hidden" name="record" value="<?php echo $record; ?>">
<input type="hidden" name="isDuplicate" value=''>
<input type="hidden" name="action">
</form>
<?php
$users = get_user_array(true, "Active", $record);
echo get_module_title($mod_strings['LBL_MODULE_NAME'],$mod_strings['LBL_MODULE_NAME'], true);
echo "<form name='Users'>
<input type='hidden' name='action' value='ListRoles'>
<input type='hidden' name='module' value='Users'>
<select name='record' onchange='document.Users.submit();'>";
echo get_select_options_with_id($users, $record);
echo "</select></form>";
if(!empty($record)){
$hideTeams = true; // to not show the teams subpanel in the following file
require_once('modules/ACLRoles/DetailUserRole.php');
}
?>

44
modules/ACLRoles/Menu.php Executable file
View File

@@ -0,0 +1,44 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
global $mod_strings;
$module_menu = Array(
Array("index.php?module=ACLRoles&action=EditView", $mod_strings['LBL_CREATE_ROLE'],"CreateRoles"),
Array("index.php?module=ACLRoles&action=index", $mod_strings['LIST_ROLES'],"Roles"),
Array("index.php?module=ACLRoles&action=ListUsers", $mod_strings['LIST_ROLES_BY_USER'],"Roles"),
);
?>

146
modules/ACLRoles/Popup_picker.php Executable file
View File

@@ -0,0 +1,146 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
class Popup_Picker
{
/*
*
*/
function Popup_Picker()
{
;
}
/*
*
*/
function _get_where_clause()
{
$where = '';
if(isset($_REQUEST['query']))
{
$where_clauses = array();
append_where_clause($where_clauses, "name", "acl_roles.name");
$where = generate_where_statement($where_clauses);
}
return $where;
}
/**
*
*/
function process_page()
{
global $mod_strings;
global $app_strings;
global $currentModule;
global $sugar_version, $sugar_config;
$output_html = '';
$where = '';
$where = $this->_get_where_clause();
$name = empty($_REQUEST['name']) ? '' : $_REQUEST['name'];
$request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
$hide_clear_button = empty($_REQUEST['hide_clear_button']) ? false : true;
$button = "<form action='index.php' method='post' name='form' id='form'>\n";
if(!$hide_clear_button)
{
$button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='"
.$app_strings['LBL_CLEAR_BUTTON_TITLE']."' accesskey='"
.$app_strings['LBL_CLEAR_BUTTON_KEY']."' value=' "
.$app_strings['LBL_CLEAR_BUTTON_LABEL']." ' />\n";
}
$button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='"
.$app_strings['LBL_CANCEL_BUTTON_TITLE']."' accesskey='"
.$app_strings['LBL_CANCEL_BUTTON_KEY']."' value=' "
.$app_strings['LBL_CANCEL_BUTTON_LABEL']." ' />\n";
$button .= "</form>\n";
$form = new XTemplate('modules/ACLRoles/Popup_picker.html');
$form->assign('MOD', $mod_strings);
$form->assign('APP', $app_strings);
$form->assign('MODULE_NAME', $currentModule);
$form->assign('NAME', $name);
$form->assign('request_data', $request_data);
ob_start();
insert_popup_header();
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
$form->parse('main.SearchHeader');
$output_html .= $form->text('main.SearchHeader');
// Reset the sections that are already in the page so that they do not print again later.
$form->reset('main.SearchHeader');
// create the listview
$seed_bean = new ACLRole();
$ListView = new ListView();
$ListView->show_export_button = false;
$ListView->process_for_popups = true;
$ListView->setXTemplate($form);
$ListView->setHeaderTitle($mod_strings['LBL_ROLE']);
$ListView->setHeaderText($button);
$ListView->setQuery($where, '', 'name', 'ROLE');
$ListView->setModStrings($mod_strings);
ob_start();
$ListView->processListView($seed_bean, 'main', 'ROLE');
$output_html .= ob_get_contents();
ob_end_clean();
$output_html .= insert_popup_footer();
return $output_html;
}
} // end of class Popup_Picker
?>

74
modules/ACLRoles/Save.php Executable file
View File

@@ -0,0 +1,74 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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->id = $_POST['record'];
if(!empty($_REQUEST['name'])){
$role->name = $_POST['name'];
$role->description = $_POST['description'];
$role->save();
//if duplicate
if(isset($_REQUEST['isduplicate']) && !empty($_REQUEST['isduplicate'])){
//duplicate actions
$role_actions=$role->getRoleActions($_REQUEST['isduplicate']);
foreach($role_actions as $module){
foreach($module as $type){
foreach($type as $act){
$role->setAction($role->id, $act['id'], $act['aclaccess']);
}
}
}
}
}else{
ob_clean();
$flc_module = 'All';
foreach($_POST as $name=>$value){
if(substr_count($name, 'act_guid') > 0){
$name = str_replace('act_guid', '', $name);
$role->setAction($role->id,$name, $value);
}
}
echo "result = {role_id:'$role->id', module:'$flc_module'}";
sugar_cleanup(true);
}
header("Location: index.php?module=ACLRoles&action=DetailView&record=". $role->id);
?>

View File

@@ -0,0 +1,55 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
$mod_strings = array (
'LBL_MODULE_NAME' => 'Roles',
'LBL_MODULE_TITLE' => 'Roles: Home',
'LBL_ROLE'=>'Role',
'LBL_NAME'=>'Name',
'LBL_DESCRIPTION'=>'Description',
'LIST_ROLES'=>'List Roles',
'LBL_USERS_SUBPANEL_TITLE'=>'Users',
'LIST_ROLES_BY_USER'=>'List Roles By User',
'LBL_LIST_FORM_TITLE' => 'Roles',
'LBL_ROLES_SUBPANEL_TITLE'=>'User Roles',
'LBL_SEARCH_FORM_TITLE'=>'Search',
'LBL_CREATE_ROLE'=>'Create Role',
'LBL_EDIT_VIEW_DIRECTIONS'=>'Double click on a cell to change value.',
'LBL_ACCESS_DEFAULT'=>'Not Set',
'LBL_ALL'=>'All',
'LBL_DUPLICATE_OF'=>'Duplicate Of ',
)
?>

View File

@@ -0,0 +1,51 @@
<?PHP
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2005 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* pl_pl.lang.ext.php,v for SugarCRM 4.5.1-->>
* Translator: Krzysztof Morawski
* All Rights Reserved.
* Any bugs report welcome: krzysiek<at>kmmgroup<dot>pl
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
'LBL_MODULE_NAME' => 'Role',
'LBL_MODULE_TITLE' => 'Role: Strona główna',
'LBL_ROLE'=>'Role',
'LBL_NAME'=>'Nazwa',
'LBL_DESCRIPTION'=>'Opis',
'LIST_ROLES'=>'Lista ról',
'LBL_USERS_SUBPANEL_TITLE'=>'Użytkownicy',
'LIST_ROLES_BY_USER'=>'Lista ról użytkowników',
'LBL_ROLES_SUBPANEL_TITLE'=>'ról użytkowników',
'LBL_SEARCH_FORM_TITLE'=>'Szukaj',
'LBL_CREATE_ROLE'=>'Utwórz rolę',
'LBL_EDIT_VIEW_DIRECTIONS'=>'Aby zmienić wartość kliknij dwukrotnie w komórkę',
'LBL_ACCESS_DEFAULT'=>'Nie ustawiono',
'LBL_ALL'=>'Wszystko',
'LBL_DUPLICATE_OF'=>'Duplikat ',
'LBL_USER_NAME_FOR_ROLE'=>'Użytkownicy/Zespół/Role',
)
?>

View File

@@ -0,0 +1,41 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
$searchFields['ACLRoles'] =
array (
'name' => array( 'query_type'=>'default'),
);
?>

View File

@@ -0,0 +1,50 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
$listViewDefs['ACLRoles'] = array(
'NAME' => array(
'width' => '20',
'label' => 'LBL_NAME',
'link' => true,
'default' => true),
'DESCRIPTION' => array(
'width' => '80',
'label' => 'LBL_DESCRIPTION',
'default' => true),
);

View File

@@ -0,0 +1,49 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
global $mod_strings;
$popupMeta = array('moduleMain' => 'ACLRole',
'varName' => 'ROLE',
'listTitle' => $mod_strings['LBL_ROLE'],
'orderBy' => 'name',
'whereClauses' => array('name' => 'acl_roles.name'),
'searchInputs' => array('name'),
'searchdefs' => array('name' => array('name' => 'name', 'label' => 'LBL_NAME',),)
);
?>

View File

@@ -0,0 +1,54 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
/*
* Created on May 29, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
$searchdefs['ACLRoles'] = array(
'templateMeta' => array(
'maxColumns' => '3',
'widths' => array('label' => '10', 'field' => '30'),
),
'layout' => array(
'basic_search' => array(
'name' => array('name' => 'name', 'label' => 'LBL_NAME',),
),
'advanced_search' => array(),
),
);
?>

View File

@@ -0,0 +1,75 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
$layout_defs['ACLRoles'] = array(
// sets up which panels to show, in which order, and with what linked_fields
'subpanel_setup' => array(
'users' => array(
'top_buttons' => array( array('widget_class' => 'SubPanelTopSelectButton', 'mode' => 'MultiSelect', 'popup_module' => 'Users'),),
'order' => 20,
'module' => 'Users',
'sort_by' => 'user_name',
'sort_order' => 'asc',
'subpanel_name' => 'default',
'get_subpanel_data' => 'users',
'add_subpanel_data' => 'user_id',
'title_key' => 'LBL_USERS_SUBPANEL_TITLE',
),
),
);
$layout_defs['UserRoles'] = array(
// sets up which panels to show, in which order, and with what linked_fields
'subpanel_setup' => array(
'aclroles' => array(
'top_buttons' => array(array('widget_class' => 'SubPanelTopSelectButton', 'mode' => 'MultiSelect','popup_module' => 'ACLRoles'),),
'order' => 20,
'module' => 'ACLRoles',
'sort_by' => 'name',
'sort_order' => 'asc',
'subpanel_name' => 'default',
'get_subpanel_data' => 'aclroles',
'add_subpanel_data' => 'role_id',
'title_key' => 'LBL_ROLES_SUBPANEL_TITLE',
),
),
);
?>

View File

@@ -0,0 +1,74 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
$subpanel_layout = array(
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton'),
),
'where' => '',
'default_order_by' => '',
'list_fields' => array(
'name'=>array(
'vname' => 'LBL_NAME',
'widget_class' => 'SubPanelDetailViewLink',
'width' => '25%',
),
'description'=>array(
'vname' => 'LBL_DESCRIPTION',
'width' => '60%',
'sortable'=>false,
),
'edit_button'=>array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'module' => 'Contacts',
'width' => '5%',
),
'remove_button'=>array(
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
'module' => 'Contacts',
'width' => '5%',
'refresh_page'=>true,
),
),
);
?>

View File

@@ -0,0 +1,76 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
$subpanel_layout = array(
'top_buttons' => array(
array('widget_class' => 'SubPanelTopCreateButton'),
array('widget_class' => 'SubPanelTopSelectButton'),
),
'where' => '',
'list_fields' => array(
'name'=>array(
'vname' => 'LBL_NAME',
'width' => '25%',
),
'description'=>array(
'vname' => 'LBL_DESCRIPTION',
'width' => '70%',
'sortable'=>false,
),
/*
'edit_button'=>array(
'vname' => 'LBL_EDIT_BUTTON',
'widget_class' => 'SubPanelEditButton',
'module' => 'Contacts',
'width' => '5%',
),
'remove_button'=>array(
'vname' => 'LBL_REMOVE',
'widget_class' => 'SubPanelRemoveButton',
'module' => 'Contacts',
'width' => '5%',
'refresh_page'=>true,
),
*/
),
);
?>

143
modules/ACLRoles/vardefs.php Executable file
View File

@@ -0,0 +1,143 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
$dictionary['ACLRole'] = array('table' => 'acl_roles', 'comment' => 'ACL Role definition'
,'fields' => array (
'id' =>
array (
'name' => 'id',
'vname' => 'LBL_ID',
'required'=>true,
'type' => 'id',
'reportable'=>false,
'comment' => 'Unique identifier'
),
'date_entered' =>
array (
'name' => 'date_entered',
'vname' => 'LBL_DATE_ENTERED',
'type' => 'datetime',
'required'=>true,
'comment' => 'Date record created'
),
'date_modified' =>
array (
'name' => 'date_modified',
'vname' => 'LBL_DATE_MODIFIED',
'type' => 'datetime',
'required'=>true,
'comment' => 'Date record last modified'
),
'modified_user_id' =>
array (
'name' => 'modified_user_id',
'rname' => 'user_name',
'id_name' => 'modified_user_id',
'vname' => 'LBL_MODIFIED',
'type' => 'assigned_user_name',
'table' => 'modified_user_id_users',
'isnull' => 'false',
'dbType' => 'id',
'required'=> false,
'len' => 36,
'reportable'=>true,
'comment' => 'User who last modified record'
),
'created_by' =>
array (
'name' => 'created_by',
'rname' => 'user_name',
'id_name' => 'created_by',
'vname' => 'LBL_CREATED',
'type' => 'assigned_user_name',
'table' => 'created_by_users',
'isnull' => 'false',
'dbType' => 'id',
'len' => 36,
'comment' => 'User who created record'
),
'name' =>
array (
'name' => 'name',
'type' => 'varchar',
'vname' => 'LBL_NAME',
'len' => 150,
'comment' => 'The role name'
),
'description' =>
array (
'name' => 'description',
'vname' => 'LBL_DESCRIPTION',
'type' => 'text',
'comment' => 'The role description'
),
'deleted' =>
array (
'name' => 'deleted',
'vname' => 'LBL_DELETED',
'type' => 'bool',
'reportable'=>false,
'comment' => 'Record deletion indicator'
),
'users' =>
array (
'name' => 'users',
'type' => 'link',
'relationship' => 'acl_roles_users',
'source'=>'non-db',
'vname'=>'LBL_USERS',
),
'actions' =>
array (
'name' => 'actions',
'type' => 'link',
'relationship' => 'acl_roles_actions',
'source'=>'non-db',
'vname'=>'LBL_USERS',
),
)
, 'indices' => array (
array('name' =>'aclrolespk', 'type' =>'primary', 'fields'=>array('id')),
array('name' =>'idx_aclrole_id_del', 'type' =>'index', 'fields'=>array('id', 'deleted')),
)
);
?>

View File

@@ -0,0 +1,50 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* 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 contact@sugarcrm.com.
*
* 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".
********************************************************************************/
require_once('include/MVC/View/views/view.list.php');
class ACLRolesViewList extends ViewList
{
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;
}
}