function _before() { parent::_before(); $mod = new \firegit\app\mod\user\User(); $users = $mod->getUsers(); $this->setData('tusers', $users); }
function index_action() { $api = new \firegit\app\mod\user\User(); $users = $api->getUsers(); $this->set('users', $users); $this->response->redirect('/guanli/project'); }
function project_team_action($group, $name) { $api = new \firegit\app\mod\git\Reposite(); $users = $api->getUsers($group, $name); $groups = $api->getGroup(); foreach ($groups as &$groupval) { $groupval['users'] = $api->getGroupUsers($groupval['group_id']); } // 所有团队成员 $uapi = new \firegit\app\mod\user\User(); $tusers = $uapi->getUsers(); $this->setLayout($this->projectLayouts)->set(array('pageTitle' => $group . '/' . $name . '的团队', 'users' => $users, 'tusers' => $tusers, 'group' => $group, 'name' => $name, 'groups' => $groups, 'userGroups' => $this->userGroups))->setView('guanli/project/team.phtml'); }
function merges_action() { $this->setBranch(); $merge = new \firegit\app\mod\git\Merge(); $merges = $merge->pagedGetMerges($this->_pn, $this->_sz, 1 | 2 | 4, $this->gitGroup, $this->gitName); $branches = $this->repo->listBranches(); $rmod = new \firegit\app\mod\git\Reposite(); $role = $rmod->getUser($this->gitGroup, $this->gitName, $this->getData('user')); $umod = new \firegit\app\mod\user\User(); $tusers = $umod->getUsers(); $this->setData('tusers', $tusers); $this->set(array('pageTitle' => '合并请求列表', 'total' => $merges['total'], 'merges' => $merges['list'], 'navType' => 'merge', 'branches' => $branches, 'notShowNav' => true, 'role' => $role))->setView('git/merges.phtml'); }
/** * 创建用户 * @param $group * @param $name * @param $username * @param $role * @throws \Exception */ function setUser($group, $name, $username, $role) { // 更加用户的配置文件 $repo = new \firegit\git\Reposite($group, $name); // 获取所有用户列表 $api = new \firegit\app\mod\user\User(); $users = $api->getUsers(); $users = array_column($users, null, 'username'); if (!isset($users[$username])) { throw new \Exception('reposite.u_userNotFound'); } Db::get('firegit')->table('fg_repo_user')->saveBody(array('repo_group' => $group, 'repo_name' => $name, 'username' => $username, 'create_time' => time(), 'repo_role' => $role))->insertOrUpdate(); $user = $users[$username]; $repo->setUser($user['username'], $user['password']); }
function user_list_action() { $id = $this->get('id'); $api = new \firegit\app\mod\git\Reposite(); $user = new \firegit\app\mod\user\User(); $users = $api->getGroupUsers($id); $groupInfo = $api->getGroupOne($id); $allUsers = $user->getUsers(); $unarr = array(); //删除已经存在本组的用户 foreach ($allUsers as $allkey => $allval) { foreach ($users as $userkey => $userval) { if ($userval['user_name'] == $allval['username']) { $unarr[$allval['username']] = $allval; unset($allUsers[$allkey]); } } } $this->setLayout($this->projectLayouts)->set(array('navType' => 'user', 'unarr' => $unarr, 'allUsers' => $allUsers, 'users' => $users, 'groupId' => $id, 'groupInfo' => $groupInfo))->setView('guanli/user/user_list.phtml'); }
function login_action() { $token = $this->get('token'); if ($token) { $userId = $this->get('user_id'); $username = $this->get('username'); $time = $this->get('time'); $token = $this->get('token'); if (time() - $time > 60) { throw new \Exception('auth.expired'); } $uapi = new \firegit\app\mod\user\User(); if (!$uapi->checkUserToken($userId, $username, $time, $token)) { throw new \Exception('auth.failed'); } $user = new \firegit\app\mod\user\Grant(); $cookieValue = $user->packSession($username, 24 * 3600); setcookie('fuser', $cookieValue, time() + 24 * 3600, '/', null, null, true); $this->response->redirect(isset($_COOKIE['rurl']) ? $_COOKIE['rurl'] : '/'); } $u = $this->get('u'); setcookie('rurl', $u, null, '/'); $this->setLayout('layout/common.phtml')->setView('user/login.phtml'); }