예제 #1
0
파일: Acl.php 프로젝트: Konstnantin/zf-app
 /**
  * 
  * @param $role
  */
 public function addRoleParents($role)
 {
     $rolesModel = new Z_Model_Roles();
     $parents = $rolesModel->getParents($role['id']);
     foreach ($parents as $parent) {
         $this->addRoleParents($parent);
         if (!$this->_getRoleRegistry()->has($parent['roleId'])) {
             $this->addRole($parent['roleId'], $rolesModel->getParentsArray($parent['id']));
         }
     }
 }
예제 #2
0
파일: User.php 프로젝트: Konstnantin/zf-app
 /**
  * Создает пользователя
  */
 public static function create($login, $password, $params = array())
 {
     $modelUsers = new Z_Model_Users();
     $modelRoles = new Z_Model_Roles();
     if ($modelUsers->fetchRow(array('login=?' => $login))) {
         return false;
     }
     $params['login'] = $login;
     $params['password'] = self::_cryptPassword($password);
     if (!isset($params['role_id'])) {
         $params['role_id'] = $modelRoles->fetchRow(array('roleId=?' => 'guest'))->id;
     }
     $userRow = $modelUsers->createRow($params);
     $userRow->save();
     return new Z_User($userRow->login);
 }