Пример #1
0
 /**
  * static removeActions($category, $type='module')
  * Removes all default actions for a category/type
  *
  * @param STRING $category - the category (e.g module name - Accounts, Contacts)
  * @param STRING $type - the type (e.g. 'module', 'field')
  */
 public static function removeActions($category, $type = 'module')
 {
     global $ACLActions;
     $db = DBManagerFactory::getInstance();
     if (isset($ACLActions[$type])) {
         foreach ($ACLActions[$type]['actions'] as $action_name => $action_def) {
             $action = new ACLAction();
             $query = "SELECT * FROM " . $action->table_name . " WHERE name='{$action_name}' AND category = '{$category}' AND acltype='{$type}' and deleted=0";
             $result = $db->query($query);
             //only add if an action with that name and category don't exist
             $row = $db->fetchByAssoc($result);
             if ($row != null) {
                 $action->mark_deleted($row['id']);
             }
         }
     } else {
         sugar_die("FAILED TO REMOVE: {$category} : {$name} - TYPE {$type} NOT DEFINED IN modules/ACLActions/actiondefs.php");
     }
 }