Пример #1
0
 public function testaddActions()
 {
     error_reporting(E_ERROR | E_PARSE);
     //take count of actions initially and then after method execution and test if action count increases
     $action_count = count(ACLAction::getDefaultActions());
     ACLAction::addActions('Test');
     $actual = ACLAction::getDefaultActions();
     $this->assertGreaterThan($action_count, count($actual));
 }
Пример #2
0
 public function run()
 {
     if (!$this->toFlavor('pro')) {
         return;
     }
     // add User field in Role
     include_once "modules/ACLActions/ACLAction.php";
     ACLAction::addActions('Users', 'module');
 }
Пример #3
0
 /**
  * Creates tables for the module implementing the class.
  * If you override this function make sure that your code can handles table creation.
  *
  */
 function create_tables()
 {
     global $dictionary;
     $key = $this->getObjectName();
     if (!array_key_exists($key, $dictionary)) {
         $GLOBALS['log']->fatal("create_tables: Metadata for table " . $this->table_name . " does not exist");
         display_notice("meta data absent for table " . $this->table_name . " keyed to {$key} ");
     } else {
         if (!$this->db->tableExists($this->table_name)) {
             $this->dbManager->createTable($this);
             if ($this->bean_implements('ACL')) {
                 if (!empty($this->acltype)) {
                     ACLAction::addActions($this->getACLCategory(), $this->acltype);
                 } else {
                     ACLAction::addActions($this->getACLCategory());
                 }
             }
         } else {
             echo "Table already exists : {$this->table_name}<br>";
         }
         if ($this->is_AuditEnabled()) {
             if (!$this->db->tableExists($this->get_audit_table_name())) {
                 $this->create_audit_table();
             }
         }
     }
 }
Пример #4
0
 * 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 $current_user, $beanList, $beanFiles, $mod_strings;
$installed_classes = array();
$ACLbeanList = $beanList;
if (is_admin($current_user)) {
    foreach ($ACLbeanList as $module => $class) {
        if (empty($installed_classes[$class]) && isset($beanFiles[$class]) && file_exists($beanFiles[$class])) {
            if ($class == 'Tracker') {
            } else {
                require_once $beanFiles[$class];
                $mod = new $class();
                $GLOBALS['log']->debug("DOING: {$class}");
                if ($mod->bean_implements('ACL') && empty($mod->acl_display_only)) {
                    // BUG 10339: do not display messages for upgrade wizard
                    if (!isset($_REQUEST['upgradeWizard'])) {
                        echo translate('LBL_ADDING', 'ACL', '') . $mod->module_dir . '<br>';
                    }
                    if (!empty($mod->acltype)) {
                        ACLAction::addActions($mod->getACLCategory(), $mod->acltype);
                    } else {
                        ACLAction::addActions($mod->getACLCategory());
                    }
                    $installed_classes[$class] = true;
                }
            }
        }
    }
}
Пример #5
0
 * 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 $current_user, $beanList, $beanFiles, $mod_strings;
$installed_classes = array();
$ACLbeanList = $beanList;
if (is_admin($current_user)) {
    foreach ($ACLbeanList as $module => $class) {
        if (empty($installed_classes[$class]) && isset($beanFiles[$class]) && file_exists($beanFiles[$class])) {
            if ($class == 'Tracker') {
            } else {
                require_once $beanFiles[$class];
                $mod = new $class();
                if ($mod->bean_implements('ACL') && empty($mod->acl_display_only)) {
                    // BUG 10339: do not display messages for upgrade wizard
                    if (!isset($_REQUEST['upgradeWizard'])) {
                        echo translate('LBL_ADDING', 'ACL', '') . $mod->module_dir . '<br>';
                    }
                    if (!empty($mod->acltype)) {
                        ACLAction::addActions($mod->module_dir, $mod->acltype);
                    } else {
                        ACLAction::addActions($mod->module_dir);
                    }
                    $installed_classes[$class] = true;
                }
            }
        }
    }
}
Пример #6
0
 /**
  * Creates tables for the module implementing the class.
  * If you override this function make sure that your code can handles table creation.
  *
  */
 function create_tables()
 {
     global $dictionary;
     $key = $this->getObjectName();
     if (!array_key_exists($key, $dictionary)) {
         $GLOBALS['log']->fatal("create_tables: Metadata for table " . $this->table_name . " does not exist");
         display_notice("meta data absent for table " . $this->table_name . " keyed to {$key} ");
     } else {
         if (!$this->db->tableExists($this->table_name)) {
             $this->db->createTable($this);
             if ($this->bean_implements('ACL')) {
                 $aclList = SugarACL::loadACLs($this->getACLCategory());
                 foreach ($aclList as $acl) {
                     if ($acl instanceof SugarACLStatic) {
                         $createACL = true;
                     }
                 }
             }
             if (!empty($createACL)) {
                 if (!empty($this->acltype)) {
                     ACLAction::addActions($this->getACLCategory(), $this->acltype);
                 } else {
                     ACLAction::addActions($this->getACLCategory());
                 }
             }
         } else {
             display_notice("Table already exists : {$this->table_name}<br>");
         }
         if ($this->is_AuditEnabled()) {
             if (!$this->db->tableExists($this->get_audit_table_name())) {
                 $this->create_audit_table();
             }
         }
     }
 }
Пример #7
0
 /** create the appropriate database tables for this bean */
 function create_tables()
 {
     global $dictionary;
     $key = $this->getObjectName();
     if (!array_key_exists($key, $dictionary)) {
         $GLOBALS['log']->fatal("create_tables: Metadata for table " . $this->table_name . " does not exist");
         display_notice("meta data absent for table " . $this->table_name . " keyed to {$key} ");
     } else {
         if (!$this->db->tableExists($this->table_name)) {
             $this->dbManager->createTable($this);
             if ($this->bean_implements('ACL')) {
                 ACLAction::addActions($this->module_dir);
             }
         } else {
             echo "Table Already Exists : {$this->table_name}<br>";
         }
     }
 }
Пример #8
0
 /**
  * create_tables
  * Override this method to insert ACLActions for the tracker beans
  *
  */
 function create_tables()
 {
     $path = 'modules/Trackers/config.php';
     if (defined('TEMPLATE_URL')) {
         $path = SugarTemplateUtilities::getFilePath($path);
     }
     require $path;
     foreach ($tracker_config as $key => $configEntry) {
         if (isset($configEntry['bean']) && $configEntry['bean'] != 'Tracker') {
             $bean = new $configEntry['bean']();
             if ($bean->bean_implements('ACL')) {
                 ACLAction::addActions($bean->module_dir, $configEntry['bean']);
             }
         }
     }
     parent::create_tables();
 }
    /**
     * Enable and Show the RevenueLine Item Module
     *
     * - Add the file that shows the RLI Module
     * - Adds the `studio.php` file
     * - Puts  RLI module from the menu bar
     * - Adds the ACL Actions
     */
    protected function fixRevenueLineItemModule()
    {
        // lets make sure the dir is there
        SugarAutoLoader::ensureDir($this->rliModuleExtFolder . '/Vardefs');
        $file_contents = <<<EOL
<?php
\$dictionary['RevenueLineItem']['importable'] = true;
\$dictionary['RevenueLineItem']['unified_search'] = true;
EOL;
        sugar_file_put_contents($this->rliModuleExtFolder . '/Vardefs/' . $this->rliModuleExtVardefFile, $file_contents);
        SugarAutoLoader::ensureDir($this->appExtFolder . '/Include');
        // we need to run the code we are putting in the custom file
        $GLOBALS['moduleList'][] = 'RevenueLineItems';
        if (isset($GLOBALS['modInvisList']) && is_array($GLOBALS['modInvisList'])) {
            foreach ($GLOBALS['modInvisList'] as $key => $mod) {
                if ($mod === 'RevenueLineItems') {
                    unset($GLOBALS['modInvisList'][$key]);
                }
            }
        }
        $file_contents = <<<EOL
<?php
\$moduleList[] = 'RevenueLineItems';
if (isset(\$modInvisList) && is_array(\$modInvisList)) {
    foreach (\$modInvisList as \$key => \$mod) {
        if (\$mod === 'RevenueLineItems') {
            unset(\$modInvisList[\$key]);
        }
    }
}
EOL;
        sugar_file_put_contents($this->appExtFolder . '/Include/' . $this->rliModuleExtFile, $file_contents);
        // enable the ACLs on RevenueLineItems
        ACLAction::addActions('RevenueLineItems');
        // show the rli module in WorkFlows
        $affected_modules = $this->toggleRevenueLineItemsLinkInWorkFlows(true);
        // show the rli module in the mega menu
        $this->setRevenueLineItemModuleTab(true);
        // handle the parent_type_field
        $this->setRevenueLineItemInParentRelateDropDown(true);
        // enable the item in the quick create
        $this->toggleRevenueLineItemQuickCreate(true);
        // place the studio file
        sugar_touch($this->rliStudioFile);
        $affected_modules[] = 'RevenueLineItems';
        return $affected_modules;
    }
 * 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-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 ********************************************************************************/
require_once 'modules/ACL/ACLController.php';
global $current_user, $beanList, $beanFiles;
if (is_admin($current_user)) {
    foreach ($beanList as $module => $class) {
        if (isset($beanFiles[$class])) {
            require_once $beanFiles[$class];
            $mod = new $class();
            if ($mod->bean_implements('ACL')) {
                echo 'Adding for ' . $module . '<br>';
                ACLAction::addActions($module);
            }
        }
    }
}