From f214a07e3f56220fb43bf179b5985030011eb56d Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 13 Dec 2018 15:29:47 +0800 Subject: [PATCH] * change for xx sso zentao. --- xuanxuan/config/ext/xuanxuanfilter.php | 6 ++ .../module/chat/ext/control/extensions.php | 11 ---- .../chat/ext/model/class/xuanxuan.class.php | 34 ++++++++++ xuanxuan/module/chat/ext/model/xuanxuan.php | 5 ++ xuanxuan/module/entry/ext/control/visit.php | 66 +++++++++++++++++++ 5 files changed, 111 insertions(+), 11 deletions(-) create mode 100644 xuanxuan/config/ext/xuanxuanfilter.php delete mode 100644 xuanxuan/module/chat/ext/control/extensions.php create mode 100644 xuanxuan/module/entry/ext/control/visit.php diff --git a/xuanxuan/config/ext/xuanxuanfilter.php b/xuanxuan/config/ext/xuanxuanfilter.php new file mode 100644 index 0000000000..19058f64eb --- /dev/null +++ b/xuanxuan/config/ext/xuanxuanfilter.php @@ -0,0 +1,6 @@ +default->get['display'] = 'code'; + +$filter->entry = new stdclass(); +$filter->entry->visit = new stdclass(); +$filter->entry->visit->get['referer'] = 'reg::any'; diff --git a/xuanxuan/module/chat/ext/control/extensions.php b/xuanxuan/module/chat/ext/control/extensions.php deleted file mode 100644 index 8ec231b152..0000000000 --- a/xuanxuan/module/chat/ext/control/extensions.php +++ /dev/null @@ -1,11 +0,0 @@ -output->result = 'success'; - $this->output->data = array(); - $this->output->users = array($userID); - die($this->app->encrypt($this->output)); - } -} diff --git a/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php b/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php index daa34d95a9..fd549d0448 100644 --- a/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php +++ b/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php @@ -22,4 +22,38 @@ class xuanxuanChat extends chatModel $this->loadModel('setting')->setItem('system.common.xxserver.installed', 1); exit; } + + public function getExtensionList($userID) + { + $entries = array(); + $baseURL = commonModel::getSysURL(); + + $actions = new stdclass(); + $actions->createBug = array('title' => "创建 Bug", 'url' => $baseURL . helper::createLink('bug', 'create', 'product=1', 'xhtml'), 'height' => "600px", 'width' => "800px"); + $actions->createDoc = array('title' => "创建文档", 'url' => $baseURL . helper::createLink('doc', 'create', 'lib=1', 'xhtml'), 'height' => "600px", 'width' => "800px"); + $actions->createStory = array('title' => "创建需求", 'url' => $baseURL . helper::createLink('story', 'create', 'product=1', 'xhtml'), 'height' => "600px", 'width' => "800px"); + $actions->createTask = array('title' => "创建任务", 'url' => $baseURL . helper::createLink('task', 'create', 'project=1', 'xhtml'), 'height' => "600px", 'width' => "800px"); + $actions->createTodo = array('title' => "创建待办", 'url' => $baseURL . helper::createLink('todo', 'create', '', 'xhtml'), 'height' => "600px", 'width' => "800px"); + + $urls['/bug-view-'] = array('height' => "700px", 'width' => "600px"); + $urls['/task-view-'] = array('height' => "700px", 'width' => "600px"); + $urls['/doc-view-'] = array('height' => "700px", 'width' => "600px"); + $urls['/story-view-'] = array('height' => "700px", 'width' => "600px"); + $urls['/todo-view-'] = array('height' => "700px", 'width' => "600px"); + + $data = new stdClass(); + $data->entryID = 1; + $data->name = 'zentao-integrated'; + $data->displayName = '禅道集成'; + $data->webViewUrl = $baseURL; + $data->download = $baseURL . $this->config->webRoot . 'zentao-integrated.zip'; + $data->md5 = '38915bcd63ca82a2a39c3536bf5ca3da'; + + $data->data['actions'] = $actions; + $data->data['urls'] = $urls; + $data->data['entryUrl'] = $baseURL; + + $entries[] = $data; + return $entries; + } } diff --git a/xuanxuan/module/chat/ext/model/xuanxuan.php b/xuanxuan/module/chat/ext/model/xuanxuan.php index 3a35a7f11f..aaef9d1adf 100644 --- a/xuanxuan/module/chat/ext/model/xuanxuan.php +++ b/xuanxuan/module/chat/ext/model/xuanxuan.php @@ -3,3 +3,8 @@ public function downloadXXD($setting) { return $this->loadExtension('xuanxuan')->downloadXXD($setting); } + +public function getExtensionList($userID) +{ + return $this->loadExtension('xuanxuan')->getExtensionList($userID); +} diff --git a/xuanxuan/module/entry/ext/control/visit.php b/xuanxuan/module/entry/ext/control/visit.php new file mode 100644 index 0000000000..d48aa07e88 --- /dev/null +++ b/xuanxuan/module/entry/ext/control/visit.php @@ -0,0 +1,66 @@ +get->referer : $referer; + if(empty($referer)) $referer = $this->createLink('index'); + + $output = new stdclass(); + $output->module = $this->moduleName; + $output->method = $this->methodName; + $output->result = 'success'; + $output->users = array(); + + $query = ''; + $query = $this->config->sessionVar . '=' . session_id(); + + $location = $referer; + $pathinfo = parse_url($location); + if(!empty($pathinfo['query'])) + { + $location = rtrim($location, '&') . "&$query"; + } + else + { + $location = rtrim($location, '?') . "?$query"; + } + $location .= "&display=card"; + $output->data = $location; + + if($this->session->userID) + { + $output->users = array($this->session->userID); + $this->loadModel('user'); + $user = $this->dao->select('*')->from(TABLE_USER)->where('id')->eq($this->session->userID)->fetch(); + + unset($user->password); + $this->user->cleanLocked($user->account); + + $user->admin = strpos($this->app->company->admins, ",{$user->account},") !== false; + $user->rights = $this->user->authorize($user->account); + $user->groups = $this->user->getGroups($user->account); + $user->view = $this->user->grantUserView($user->account, $user->rights['acls']); + + $last = time(); + $user->last = date(DT_DATETIME1, $last); + $user->lastTime = $user->last; + $user->ip = $this->session->clientIP->IP; + + $this->session->set('user', $user); + $this->app->user = $this->session->user; + } + + die($this->app->encrypt($output)); + } +}