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


PHP SecurityGroup::inherit方法代码示例

本文整理汇总了PHP中SecurityGroup::inherit方法的典型用法代码示例。如果您正苦于以下问题:PHP SecurityGroup::inherit方法的具体用法?PHP SecurityGroup::inherit怎么用?PHP SecurityGroup::inherit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SecurityGroup的用法示例。


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

示例1: testinherit

 public function testinherit()
 {
     //unset and reconnect Db to resolve mysqli fetch exeception
     global $db;
     unset($db->database);
     $db->checkConnection();
     $account = new Account();
     $account->id = 1;
     $_REQUEST['subpanel_field_name'] = 'id';
     //execute the method and test if it works and does not throws an exception.
     try {
         SecurityGroup::inherit($account, false);
         $this->assertTrue(true);
     } catch (Exception $e) {
         $this->fail();
     }
 }
开发者ID:sacredwebsite,项目名称:SuiteCRM,代码行数:17,代码来源:SecurityGroupTest.php

示例2: save


//.........这里部分代码省略.........
     }
     if (empty($this->date_modified) || $this->update_date_modified) {
         $this->date_modified = $GLOBALS['timedate']->nowDb();
     }
     $this->_checkOptimisticLocking($action, $isUpdate);
     if (!empty($this->modified_by_name)) {
         $this->old_modified_by_name = $this->modified_by_name;
     }
     if ($this->update_modified_by) {
         $this->modified_user_id = 1;
         if (!empty($current_user)) {
             $this->modified_user_id = $current_user->id;
             $this->modified_by_name = $current_user->user_name;
         }
     }
     if ($this->deleted != 1) {
         $this->deleted = 0;
     }
     if (!$isUpdate) {
         if (empty($this->date_entered)) {
             $this->date_entered = $this->date_modified;
         }
         if ($this->set_created_by == true) {
             // created by should always be this user
             $this->created_by = isset($current_user) ? $current_user->id : "";
         }
         if ($this->new_with_id == false) {
             $this->id = create_guid();
         }
     }
     require_once "data/BeanFactory.php";
     BeanFactory::registerBean($this->module_name, $this);
     if (empty($GLOBALS['updating_relationships']) && empty($GLOBALS['saving_relationships']) && empty($GLOBALS['resavingRelatedBeans'])) {
         $GLOBALS['saving_relationships'] = true;
         // let subclasses save related field changes
         $this->save_relationship_changes($isUpdate);
         $GLOBALS['saving_relationships'] = false;
     }
     if ($isUpdate && !$this->update_date_entered) {
         unset($this->date_entered);
     }
     // call the custom business logic
     $custom_logic_arguments['check_notify'] = $check_notify;
     $this->call_custom_logic("before_save", $custom_logic_arguments);
     unset($custom_logic_arguments);
     // If we're importing back semi-colon separated non-primary emails
     if ($this->hasEmails() && !empty($this->email_addresses_non_primary) && is_array($this->email_addresses_non_primary)) {
         // Add each mail to the account
         foreach ($this->email_addresses_non_primary as $mail) {
             $this->emailAddress->addAddress($mail);
         }
         $this->emailAddress->save($this->id, $this->module_dir);
     }
     if (isset($this->custom_fields)) {
         $this->custom_fields->bean = $this;
         $this->custom_fields->save($isUpdate);
     }
     // use the db independent query generator
     $this->preprocess_fields_on_save();
     //construct the SQL to create the audit record if auditing is enabled.
     $auditDataChanges = array();
     if ($this->is_AuditEnabled()) {
         if ($isUpdate && !isset($this->fetched_row)) {
             $GLOBALS['log']->debug('Auditing: Retrieve was not called, audit record will not be created.');
         } else {
             $auditDataChanges = $this->db->getAuditDataChanges($this);
         }
     }
     $this->_sendNotifications($check_notify);
     if ($isUpdate) {
         $this->db->update($this);
     } else {
         $this->db->insert($this);
     }
     if (!empty($auditDataChanges) && is_array($auditDataChanges)) {
         foreach ($auditDataChanges as $change) {
             $this->db->save_audit_records($this, $change);
         }
     }
     if (empty($GLOBALS['resavingRelatedBeans'])) {
         SugarRelationship::resaveRelatedBeans();
     }
     // populate fetched row with current bean values
     foreach ($auditDataChanges as $change) {
         $this->fetched_row[$change['field_name']] = $change['after'];
     }
     /* BEGIN - SECURITY GROUPS - inheritance */
     require_once 'modules/SecurityGroups/SecurityGroup.php';
     SecurityGroup::inherit($this, $isUpdate);
     /* END - SECURITY GROUPS */
     //If we aren't in setup mode and we have a current user and module, then we track
     if (isset($GLOBALS['current_user']) && isset($this->module_dir)) {
         $this->track_view($current_user->id, $this->module_dir, 'save');
     }
     $this->call_custom_logic('after_save', '');
     //Now that the record has been saved, we don't want to insert again on further saves
     $this->new_with_id = false;
     $this->in_save = false;
     return $this->id;
 }
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:101,代码来源:SugarBean.php

示例3: save


//.........这里部分代码省略.........
                     if (isset($this->field_name_map) && !empty($this->field_name_map[$field]['custom_type'])) {
                         continue;
                     }
                     // Only assign variables that have been set.
                     if (isset($this->{$field})) {
                         //bug: 37908 - this is to handle the issue where the bool value is false, but strlen(false) <= so it will
                         //set the default value. TODO change this code to esend all fields through getFieldValue() like DbHelper->insertSql
                         if (!empty($value['type']) && $value['type'] == 'bool') {
                             $this->{$field} = $this->getFieldValue($field);
                         }
                         if (strlen($this->{$field}) <= 0) {
                             if (!$isUpdate && isset($value['default']) && strlen($value['default']) > 0) {
                                 $this->{$field} = $value['default'];
                             } else {
                                 $this->{$field} = null;
                             }
                         }
                         // Try comparing this element with the head element.
                         if (0 == $firstPass) {
                             $firstPass = 1;
                         } else {
                             $query .= ", ";
                         }
                         if (is_null($this->{$field})) {
                             $query .= $field . "=null";
                         } elseif (isset($value['len'])) {
                             $query .= $field . "='" . $this->db->quote($this->db->truncate(from_html($this->{$field}), $value['len'])) . "'";
                         } else {
                             $query .= $field . "='" . $this->db->quote($this->{$field}) . "'";
                         }
                     }
                 }
             }
             $query = $query . " WHERE ID = '{$this->id}'";
             $GLOBALS['log']->info("Update {$this->object_name}: " . $query);
         } else {
             $colums = array();
             $values = array();
             foreach ($this->field_defs as $field => $value) {
                 if (!isset($value['source']) || $value['source'] == 'db') {
                     // Do not write out the id field on the update statement.
                     // We are not allowed to change ids.
                     //if($isUpdate && ('id' == $field)) continue;
                     //custom fields handle there save seperatley
                     if (isset($this->field_name_map) && !empty($this->field_name_map[$field]['custom_module'])) {
                         continue;
                     }
                     // Only assign variables that have been set.
                     if (isset($this->{$field})) {
                         //trim the value in case empty space is passed in.
                         //this will allow default values set in db to take effect, otherwise
                         //will insert blanks into db
                         $trimmed_field = trim($this->{$field});
                         //if this value is empty, do not include the field value in statement
                         if ($trimmed_field == '') {
                             continue;
                         }
                         //bug: 37908 - this is to handle the issue where the bool value is false, but strlen(false) <= so it will
                         //set the default value. TODO change this code to esend all fields through getFieldValue() like DbHelper->insertSql
                         if (!empty($value['type']) && $value['type'] == 'bool') {
                             $this->{$field} = $this->getFieldValue($field);
                         }
                         //added check for ints because sql-server does not like casting varchar with a decimal value
                         //into an int.
                         if (isset($value['type']) and $value['type'] == 'int') {
                             $values[] = $this->db->quote($this->{$field});
                         } elseif (isset($value['len'])) {
                             $values[] = "'" . $this->db->quote($this->db->truncate(from_html($this->{$field}), $value['len'])) . "'";
                         } else {
                             $values[] = "'" . $this->db->quote($this->{$field}) . "'";
                         }
                         $columns[] = $field;
                     }
                 }
             }
             // build out the SQL INSERT statement.
             $query = "INSERT INTO {$this->table_name} (" . implode(",", $columns) . " ) VALUES ( " . implode(",", $values) . ')';
             $GLOBALS['log']->info("Insert: " . $query);
         }
         $GLOBALS['log']->info("Save: {$query}");
         $this->db->query($query, true);
     }
     if (!empty($dataChanges) && is_array($dataChanges)) {
         foreach ($dataChanges as $change) {
             $this->dbManager->helper->save_audit_records($this, $change);
         }
     }
     // let subclasses save related field changes
     $this->save_relationship_changes($isUpdate);
     /* BEGIN - SECURITY GROUPS - inheritance */
     require_once 'modules/SecurityGroups/SecurityGroup.php';
     SecurityGroup::inherit($this, $isUpdate);
     /* END - SECURITY GROUPS */
     //If we aren't in setup mode and we have a current user and module, then we track
     if (isset($GLOBALS['current_user']) && isset($this->module_dir)) {
         $this->track_view($current_user->id, $this->module_dir, 'save');
     }
     $this->call_custom_logic('after_save', '');
     return $this->id;
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:101,代码来源:SugarBean.php


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