Beispiel #1
0
 /**
  * Enter description here...
  *
  */
 public function delete()
 {
     if (!$this->_mapper->countGroupMembers($this)) {
         foreach ($this->getChildren() as $obGroup) {
             $this->_mapper->tree->removeNode($obGroup);
             $obGroup->delete();
         }
         $this->_mapper->tree->removeNode($this);
         return parent::delete();
     } else {
         $res = new RM_Base_Result();
         $res->error('cannot_delete_group_with_users');
         throw new RM_Validator_Exception($res);
     }
 }
Beispiel #2
0
 /**
  *	Constructor
  *
  *	@return
  */
 public function __construct()
 {
     parent::__construct(qw2('userClass>RM_User_Object'));
     $this->_day_results = array('-2' => 'В отпуске', '-1' => 'Не покупал', '0' => 'Не работал', '>0' => 'Сканировал');
     $this->_guidTypeUser = G('user');
     $this->_guidTypeGroup = G('user-group');
     $this->_guidTypePerson = G('user-person');
     $this->_fields = array('user' => qw2('id>user_id user_hash_id login password active first_name middle_name last_name phone _created_datetime _edited_datetime _created_user_id _edited_user_id home_longitude home_latitude home_address home_index work_longitude work_latitude work_address city_id status_id ssp_collab_type collab_initials collab_phone collab_time collab_day collab_workaday_time_1 collab_workaday_time_2 collab_workaday_time_3 collab_workaday_time_4 collab_rest_time_1 collab_rest_time_2 collab_rest_time_3 collab_rest_time_4 collab_comments collab_maybe_comment collab_reject_comment scanner_num setup_date notebook_serial mobile_serial passport_number passport_department register_address who_set_scanner is_tester diary_access_disabled user_reg_from date_reject extended_info equipment equipment_removed modem_num home_street home_bld work_street work_bld panelist_deny admin_group deny_status repair_status ssl_number animal_data init_status inn_id pensionary_id area_id metro_id payment_method payment_info compensation_method compensation_info email_confirmed document_copy stream internet_connection_type'), 'group' => qw2('id parent_id name weight ssl_only alias'), 'person' => qw2('id user_id first_name middle_name last_name sex birthday is_animal animal_type is_panelist phone_exists phone is_deleted animal_breed_id animal_weight_id animal_castrated animal_certificate animal_descr'), 'leave' => qw2('id user_id date_from date_to cdate mdate'), 'day' => qw2('id event_date user_id result_id last_visited last_logged user_agent remote_addr x_forwarded_for diary_version cdate mdate'));
     $storages = array('user' => M('Store')->storage(array('table' => $this->_tables['user'], 'table-history' => $this->_tables['user_history'], 'ctorArgs' => array('mapper' => $this), 'keys' => qw2('id login'), 'props' => $this->_getProps('user'), 'class' => 'RM_User_Object', 'guid' => $this->_guidTypeUser, 'validator' => M('Validator')->create(array('first_name' => 'not_empty', 'middle_name' => 'not_empty', 'login' => array('and', 'not_empty', 'email'), 'phone' => 'not_empty', 'password' => 'not_empty')))), 'group' => M('Store')->storage(array('table' => $this->_tables['group'], 'ctorArgs' => array('mapper' => $this), 'auto-id-prop' => 'id', 'keys' => qw2('id alias name'), 'props' => $this->_getProps('group'), 'class' => 'RM_User_Group', 'guid' => $this->_guidTypeGroup)), 'person' => M('Store')->storage(array('table' => $this->_tables['person'], 'table-history' => $this->_tables['person_history'], 'ctorArgs' => array('mapper' => $this), 'keys' => qw2('id'), 'props' => $this->_getProps('person'), 'class' => 'RM_User_Family_Object', 'guid' => $this->_guidTypePerson)), 'leave' => M('Store')->storage(array('table' => $this->_tables['leave'], 'ctorArgs' => array('mapper' => $this), 'auto-id-prop' => 'id', 'keys' => qw2('id'), 'props' => $this->_getProps('leave'), 'class' => 'RM_User_Leave', 'validator' => M('Validator')->create(array('date_from' => 'not_empty', 'date_to' => 'not_empty')))));
     foreach ($storages as $k => $v) {
         $this->_storage[$k] = $v;
     }
     if (C('user.cache-active')) {
         $this->_grpCacheNs = C('user.group-cache-ns');
         $this->_lstCacheNs = C('user.list-cache-ns');
         $this->_authCacheNs = C('user.auth-cache-ns');
         //$this->_grpCachePrefix	= C('user.group-cache-prefix');
     }
     $this->tree = M('Tree')->createDbTree($this->_tables['group_tree'], array($this, '_getRootNodes'));
 }
Beispiel #3
0
 public function removeUserFromGroup(RM_Account_iGroup $group)
 {
     return $this->_mapper->memberDelete($group, $this);
 }
Beispiel #4
0
 public function memberDeleteAll($obj)
 {
     if (!$obj instanceof RM_Client_Object) {
         throw new Exception(__METHOD__ . "(): RM_Client_Object expected!");
     }
     if ($this->_grpCacheNs) {
         M('Cache')->clear($this->_grpCacheNs, $user->id());
     }
     parent::memberDeleteAll($obj);
 }
Beispiel #5
0
 public function removeUserFromGroup(RM_Account_iUser $user)
 {
     return $this->_mapper->memberDelete($this, $user);
 }