public function getUserByKey() { $keyId = Input::post('key'); $key = Key::findOne(['id' => $keyId]); if (!empty($key)) { $account = Account::findOne(['uid' => $key->uid]); if (!empty($account)) { Response::json(['code' => 0, 'data' => ['key' => $key, 'name' => $account->identifier]]); return; } } Response::json(['code' => 1, 'message' => '未获取帐号信息']); }
public function checkAccess() { Loader::helper('Repo'); $command = Input::request('command'); $keyId = Input::request('key_id'); $repo = fetchRepoIdentifier(Input::request('repo')); $result = false; if ($command == 'git-upload-pack') { $result = $this->_pullCommandAccessCheck($repo, $keyId); } else { $result = $this->_pushCommandAccessCheck($repo, $keyId); } Response::json(['code' => 0, 'data' => $result]); }
public function handle(array $params = null) { $tokenName = Application::getInstance()->config->get('App.cookie_prefix') . Application::getInstance()->config->get('App.token_cookie_name'); $token = Input::cookie($tokenName); if (!empty($token)) { $result = Account::where('ucenter_token', $token)->limit(1)->get(); if (!empty($result)) { $result = $result[0]; if (time() < $result->token_expired) { Request::addParameter('currentAccount', $result); } } } }
public function processCreateProject() { $args = Input::post(); /** * @var \Proxy\ProjectProxy $projectProxy */ $projectProxy = Loader::proxy('ProjectProxy'); //创建项目 $project = $projectProxy->createProject($args); Response::json(['code' => 0, 'data' => ['project' => $project, 'account' => Request::getParameter('currentAccount')]]); }