Пример #1
0
 /**
  * Add a user to both containers.
  *
  * @param  array auth user data and perm type
  * @return int|bool perm user id or false
  *
  * @access public
  */
 function addUser($data)
 {
     if (!is_object($this->auth) || !is_object($this->perm)) {
         $this->stack->push(LIVEUSER_ADMIN_ERROR, 'exception', array('msg' => 'Perm and/or Auth container not set.'));
         return false;
     }
     if (array_key_exists('perm_type', $data)) {
         $type = $data['perm_type'];
         unset($data['perm_type']);
     } else {
         $type = LIVEUSER_USER_TYPE_ID;
     }
     $authUserId = $this->auth->addUser($data);
     if (!$authUserId) {
         return false;
     }
     $data = array('auth_user_id' => $authUserId, 'auth_container_name' => $this->authContainerName, 'perm_type' => $type);
     return $this->perm->addUser($data);
 }