From 50460830e201bdccd87903fb35683605b3150741 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 26 Sep 2017 11:08:11 +0800 Subject: [PATCH] * adjust for limited user. --- db/update9.5.sql | 1 - module/bug/model.php | 4 +-- module/bug/view/browse.html.php | 20 +++++++------- module/bug/view/view.html.php | 6 ++-- module/build/model.php | 15 ---------- module/common/model.php | 35 +++++++++++------------- module/company/view/browse.html.php | 4 +-- module/doc/model.php | 15 ---------- module/group/lang/resource.php | 2 ++ module/my/lang/en.php | 1 + module/my/lang/zh-cn.php | 1 + module/my/view/profile.html.php | 4 --- module/product/model.php | 2 -- module/product/view/browse.html.php | 11 ++++---- module/productplan/model.php | 15 ---------- module/project/control.php | 5 ++-- module/project/model.php | 9 ++---- module/project/view/story.html.php | 9 +++--- module/project/view/taskheader.html.php | 11 ++++---- module/project/view/team.html.php | 2 +- module/release/model.php | 15 ---------- module/story/model.php | 2 -- module/task/model.php | 4 +-- module/testcase/model.php | 8 ++---- module/testcase/view/caseheader.html.php | 22 +++++++-------- module/testsuite/model.php | 15 ---------- module/testtask/model.php | 8 ++---- module/user/config.php | 4 +-- module/user/lang/zh-cn.php | 25 +++++++---------- module/user/model.php | 3 -- module/user/view/batchcreate.html.php | 2 -- module/user/view/batchedit.html.php | 2 -- module/user/view/create.html.php | 5 ---- module/user/view/edit.html.php | 2 -- 34 files changed, 85 insertions(+), 204 deletions(-) diff --git a/db/update9.5.sql b/db/update9.5.sql index 41d9aef0af..ee07d0742e 100644 --- a/db/update9.5.sql +++ b/db/update9.5.sql @@ -1,3 +1,2 @@ ALTER TABLE `zt_bug` ADD `activatedDate` datetime NOT NULL AFTER `activatedCount`; -ALTER TABLE `zt_user` ADD `limitedUser` varchar(8) NOT NULL default 'no' AFTER `role`; ALTER TABLE `zt_team` ADD `limitedUser` varchar(8) NOT NULL default 'no' AFTER `role`; diff --git a/module/bug/model.php b/module/bug/model.php index c52e931da7..a000ddb286 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2243,8 +2243,6 @@ class bugModel extends model { $action = strtolower($action); - if(!common::limitedUser($object)) return false; - if($action == 'confirmbug') return $object->status == 'active' and $object->confirmed == 0; if($action == 'resolve') return $object->status == 'active'; if($action == 'close') return $object->status == 'resolved'; @@ -2405,7 +2403,7 @@ class bugModel extends model case 'actions': $params = "bugID=$bug->id"; common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'search', '', 'iframe', true); - common::printIcon('bug', 'assignTo', $params, '', 'list', '', '', 'iframe', true); + common::printIcon('bug', 'assignTo', $params, $bug, 'list', '', '', 'iframe', true); common::printIcon('bug', 'resolve', $params, $bug, 'list', '', '', 'iframe', true); common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true); common::printIcon('bug', 'edit', $params, $bug, 'list'); diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index 10e72a610e..d2443e5a5e 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -37,16 +37,15 @@ js::set('branch', $branch); $misc = common::hasPriv('bug', 'create') ? "class='btn btn-primary'" : "class='btn btn-primary disabled'"; $link = common::hasPriv('bug', 'create') ? $this->createLink('bug', 'create', "productID=$productID&branch=$branch&extra=moduleID=$moduleID") : '#'; echo html::a($link, "" . $lang->bug->create, '', $misc); + + $misc = common::hasPriv('bug', 'batchCreate') ? '' : "disabled"; + $link = common::hasPriv('bug', 'batchCreate') ? $this->createLink('bug', 'batchCreate', "productID=$productID&branch=$branch&projectID=0&moduleID=$moduleID") : '#'; ?> - @@ -129,15 +128,16 @@ js::set('branch', $branch); $link = common::hasPriv('bug', 'create') ? $this->createLink('bug', 'create', "productID=$productID&branch=$branch&extra=moduleID=$moduleID") : '#'; echo html::a($link, "" . $lang->bug->create, '', $misc); } + + $misc = common::hasPriv('bug', 'batchCreate') ? '' : "disabled"; + $link = common::hasPriv('bug', 'batchCreate') ? $this->createLink('bug', 'batchCreate', "productID=$productID&branch=$branch&projectID=0&moduleID=$moduleID") : '#'; ?> - diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index 971a665670..566e8e240b 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -240,7 +240,7 @@ - + @@ -260,7 +260,7 @@ - + @@ -277,7 +277,7 @@ - + diff --git a/module/build/model.php b/module/build/model.php index f6d1cb1999..7215c274c8 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -407,19 +407,4 @@ class buildModel extends model $this->loadModel('action')->create('bug', $unlinkBugID, 'unlinkedfrombuild', '', $buildID); } } - - /** - * Judge an action is clickable or not. - * - * @param object $project - * @param string $action - * @access public - * @return bool - */ - public static function isClickable($build, $action) - { - if(!common::limitedUser($build)) return false; - - return true; - } } diff --git a/module/common/model.php b/module/common/model.php index aa28cb7b24..797fdfdd13 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -674,7 +674,7 @@ class commonModel extends model if(strtolower($module) == 'story' and strtolower($method) == 'createcase') ($module = 'testcase') and ($method = 'create'); if(strtolower($module) == 'bug' and strtolower($method) == 'tostory') ($module = 'story') and ($method = 'create'); if(strtolower($module) == 'bug' and strtolower($method) == 'createcase') ($module = 'testcase') and ($method = 'create'); - if(!commonModel::hasPriv($module, $method)) return false; + if(!commonModel::hasPriv($module, $method, $object)) return false; $link = helper::createLink($module, $method, $vars, '', $onlyBody); /* Set the icon title, try search the $method defination in $module's lang or $common's lang. */ @@ -1140,7 +1140,7 @@ class commonModel extends model if(isset($rights[$module][$method])) { - if(!commonModel::limitedUser($object, $module, $method)) return false; + if(!commonModel::hasDBPriv($object, $module, $method)) return false; if(empty($acls['views'])) return true; $menu = isset($lang->menugroup->$module) ? $lang->menugroup->$module : $module; @@ -1157,29 +1157,26 @@ class commonModel extends model return false; } - public static function limitedUser($object, $module = null, $method = null) + public static function hasDBPriv($object, $module = null, $method = null) { global $app; - if(!empty($app->user->admin) || $app->user->account == 'guest') return true; + if(!empty($app->user->admin)) return true; // limited project $limitedProject = false; - if(!empty($module) && $module == 'task' && !empty($object->project) || - !empty($module) && $module == 'task' && !empty($object->id)) + if(!empty($module) && $module == 'task' && !empty($object->project) or + !empty($module) && $module == 'project' && !empty($object->id)) { $objectID = ''; - if(!empty($object->id)) $objectID = $object->id; + if(!empty($object->id)) $objectID = $object->id; if(!empty($object->id) && !empty($object->project)) $objectID = $object->project; - $sessionKey = $app->user->account . 'project' . $objectID; - if(!empty($_SESSION[$sessionKey]) && $_SESSION[$sessionKey] == $objectID) - { - $limitedProject = true; - } + $limitedProjects = !empty($_SESSION['limitedProjects']) ? $_SESSION['limitedProjects'] : ''; + if(strpos(",{$limitedProjects},", ",$objectID,") !== false) $limitedProject = true; } - if(!empty($app->user->limitedUser) && $app->user->limitedUser === 'no' && !$limitedProject) return true; + if(empty($app->user->rights['rights']['my']['limited']) && !$limitedProject) return true; if(!is_null($method) && strpos($method, 'batch') === 0) return false; if(!is_null($method) && strpos($method, 'link') === 0) return false; @@ -1188,12 +1185,12 @@ class commonModel extends model if(is_null($object)) return true; - if(!empty($object->openedBy) && $object->openedBy == $app->user->account || - !empty($object->addedBy) && $object->addedBy == $app->user->account || - !empty($object->assignedTo) && $object->assignedTo == $app->user->account || - !empty($object->finishedBy) && $object->finishedBy == $app->user->account || - !empty($object->canceledBy) && $object->canceledBy == $app->user->account || - !empty($object->closedBy) && $object->closedBy == $app->user->account || + if(!empty($object->openedBy) && $object->openedBy == $app->user->account or + !empty($object->addedBy) && $object->addedBy == $app->user->account or + !empty($object->assignedTo) && $object->assignedTo == $app->user->account or + !empty($object->finishedBy) && $object->finishedBy == $app->user->account or + !empty($object->canceledBy) && $object->canceledBy == $app->user->account or + !empty($object->closedBy) && $object->closedBy == $app->user->account or !empty($object->lastEditedBy) && $object->lastEditedBy == $app->user->account) { return true; diff --git a/module/company/view/browse.html.php b/module/company/view/browse.html.php index 3421629b69..3223d9d404 100644 --- a/module/company/view/browse.html.php +++ b/module/company/view/browse.html.php @@ -49,7 +49,6 @@ js::set('confirmDelete', $lang->user->confirmDelete); - @@ -76,7 +75,6 @@ js::set('confirmDelete', $lang->user->confirmDelete); - - - - - - diff --git a/module/product/model.php b/module/product/model.php index e98e20a91f..c6c579931d 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -830,8 +830,6 @@ class productModel extends model { $action = strtolower($action); - if(!common::limitedUser($product)) return false; - if($action == 'close') return $product->status != 'closed'; return true; diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index c50987bb11..098c419bbf 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -70,16 +70,15 @@ $link = common::hasPriv('story', 'create') ? $this->createLink('story', 'create', "productID=$productID&branch=$branch&moduleID=$moduleID") : '#'; echo html::a($link, "" . $lang->story->create, '', $misc); } + + $misc = common::hasPriv('story', 'batchCreate') ? '' : "disabled"; + $link = common::hasPriv('story', 'batchCreate') ? $this->createLink('story', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$moduleID") : '#'; ?> - diff --git a/module/productplan/model.php b/module/productplan/model.php index 31631c9369..0515da1666 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -304,19 +304,4 @@ class productplanModel extends model $this->dao->update(TABLE_BUG)->set('plan')->eq(0)->where('id')->eq((int)$bugID)->exec(); $this->loadModel('action')->create('bug', $bugID, 'unlinkedfromplan', '', $planID); } - - /** - * Judge an action is clickable or not. - *- - * @param object $product- - * @param string $action- - * @access public - * @return void - */ - public static function isClickable($productPlan, $action) - { - if(!common::limitedUser($productPlan)) return false; - - return true; - } } diff --git a/module/project/control.php b/module/project/control.php index e9cda0e0f1..b329faf27d 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -102,7 +102,6 @@ class project extends control $this->view->childProjects = $childProjects; $this->view->products = $products; $this->view->teamMembers = $teamMembers; - $this->view->actions = $actions; return $project; } @@ -538,6 +537,8 @@ class project extends control $this->loadModel('user'); $this->app->loadLang('testcase'); + $this->project->getLimitedProject(); + /* Save session. */ $this->app->session->set('storyList', $this->app->getURI(true)); @@ -597,6 +598,7 @@ class project extends control $this->view->title = $title; $this->view->position = $position; $this->view->productID = $productID; + $this->view->project = $project; $this->view->stories = $stories; $this->view->summary = $this->product->summary($stories); $this->view->orderBy = $orderBy; @@ -610,7 +612,6 @@ class project extends control $this->view->users = $users; $this->view->pager = $pager; $this->view->branchGroups = $branchGroups; - $this->view->limitedUser = $this->app->user->limitedUser == 'yes' ? true : false; $this->display(); } diff --git a/module/project/model.php b/module/project/model.php index 8cdf7cba71..9bdb76f892 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1751,8 +1751,6 @@ class projectModel extends model { $action = strtolower($action); - if(!common::limitedUser($project, 'project')) return false; - if($action == 'start') return $project->status == 'wait'; if($action == 'close') return $project->status != 'done'; if($action == 'suspend') return $project->status == 'wait' or $project->status == 'doing'; @@ -1882,11 +1880,8 @@ class projectModel extends model if($this->app->user->admin) return true; /* Get all teams of all projects and group by projects, save it as static. */ - $teams = $this->dao->select('project, limitedUser')->from(TABLE_TEAM)->where('account')->eq($this->app->user->account)->fetchAll('project'); - foreach($teams as $projectID => $object) - { - if($object->limitedUser == 'yes') $this->session->set($this->app->user->account . 'project' . $object->project, $object->project); - } + $projects = $this->dao->select('project, limitedUser')->from(TABLE_TEAM)->where('account')->eq($this->app->user->account)->andWhere('limitedUser')->eq('yes')->orderBy('project asc')->fetchPairs('project', 'project'); + $_SESSION['limitedProjects'] = join(',', $projects); } /** diff --git a/module/project/view/story.html.php b/module/project/view/story.html.php index cf81b8a1ba..c09e6292c5 100644 --- a/module/project/view/story.html.php +++ b/module/project/view/story.html.php @@ -119,6 +119,7 @@ '; diff --git a/module/testcase/model.php b/module/testcase/model.php index f96e07516b..fe50967fe1 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -932,8 +932,6 @@ class testcaseModel extends model { $action = strtolower($action); - if(!common::limitedUser($case)) return false; - if($action == 'createbug') return $case->caseFails > 0; if($action == 'review') return $case->status == 'wait'; @@ -1313,13 +1311,13 @@ class testcaseModel extends model echo $case->stepNumber; break; case 'actions': - common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", '', 'list', 'play', '', 'runCase iframe', false, "data-width='95%'"); - common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", '', 'list', '', '', 'results iframe', '', "data-width='90%'"); + common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", $case, 'list', 'play', '', 'runCase iframe', false, "data-width='95%'"); + common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", $case, 'list', '', '', 'results iframe', '', "data-width='90%'"); if($this->config->testcase->needReview or !empty($this->config->testcase->forceReview)) common::printIcon('testcase', 'review', "caseID=$case->id", $case, 'list', 'review', '', 'iframe'); common::printIcon('testcase', 'edit', "caseID=$case->id", $case, 'list'); common::printIcon('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase¶m=$case->id", $case, 'list', 'copy'); - if(common::hasPriv('testcase', 'delete')) + if(common::hasPriv('testcase', 'delete', $case)) { $deleteURL = helper::createLink('testcase', 'delete', "caseID=$case->id&confirm=yes"); echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"batchForm\",confirmDelete)", '', '', "title='{$this->lang->testcase->delete}' class='btn-icon'"); diff --git a/module/testcase/view/caseheader.html.php b/module/testcase/view/caseheader.html.php index a89ea1c26c..14d2d1ca0f 100644 --- a/module/testcase/view/caseheader.html.php +++ b/module/testcase/view/caseheader.html.php @@ -23,16 +23,15 @@ $misc = common::hasPriv('testcase', 'create') ? "class='btn btn-primary'" : "class='btn btn-primary disabled'"; $link = common::hasPriv('testcase', 'create') ? $this->createLink('testcase', 'create', "productID=$productID&branch=$branch&moduleID=$initModule") : '#'; echo html::a($link, "" . $lang->testcase->create, '', $misc); + + $misc = common::hasPriv('testcase', 'batchCreate') ? '' : "disabled"; + $link = common::hasPriv('testcase', 'batchCreate') ? $this->createLink('testcase', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$initModule") : '#'; ?> - @@ -208,16 +207,15 @@ $misc = common::hasPriv('testcase', 'create') ? "class='btn btn-primary'" : "class='btn btn-primary disabled'"; $link = common::hasPriv('testcase', 'create') ? $this->createLink('testcase', 'create', "productID=$productID&branch=$branch&moduleID=$initModule") : '#'; echo html::a($link, "" . $lang->testcase->create, '', $misc); + + $misc = common::hasPriv('testcase', 'batchCreate') ? '' : "disabled"; + $link = common::hasPriv('testcase', 'batchCreate') ? $this->createLink('testcase', 'batchCreate', "productID=$productID&branch=$branch&moduleID=$initModule") : '#'; ?> - diff --git a/module/testsuite/model.php b/module/testsuite/model.php index 090da3af16..f2a1f288d7 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -804,19 +804,4 @@ class testsuiteModel extends model } } } - - /** - * Judge an action is clickable or not. - *- - * @param object $product- - * @param string $action- - * @access public - * @return void - */ - public static function isClickable($testsuite, $action) - { - if(!common::limitedUser($testsuite)) return false; - - return true; - } } diff --git a/module/testtask/model.php b/module/testtask/model.php index 61ff1bb631..6b4a06f3e0 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -1099,8 +1099,6 @@ class testtaskModel extends model { $action = strtolower($action); - if(!common::limitedUser($testtask)) return false; - if($action == 'start') return $testtask->status == 'wait'; if($action == 'block') return ($testtask->status == 'doing' || $testtask->status == 'wait'); if($action == 'activate') return ($testtask->status == 'blocked' || $testtask->status == 'done'); @@ -1194,10 +1192,10 @@ class testtaskModel extends model echo $run->stepNumber; break; case 'actions': - common::printIcon('testtask', 'runCase', "id=$run->id", '', 'list', '', '', 'runCase iframe', false, "data-width='95%'"); - common::printIcon('testtask', 'results', "id=$run->id", '', 'list', '', '', 'iframe', '', "data-width='90%'"); + common::printIcon('testtask', 'runCase', "id=$run->id", $run, 'list', '', '', 'runCase iframe', false, "data-width='95%'"); + common::printIcon('testtask', 'results', "id=$run->id", $run, 'list', '', '', 'iframe', '', "data-width='90%'"); - if(common::hasPriv('testtask', 'unlinkCase')) + if(common::hasPriv('testtask', 'unlinkCase', $run)) { $unlinkURL = helper::createLink('testtask', 'unlinkCase', "caseID=$run->id&confirm=yes"); echo html::a("javascript:ajaxDelete(\"$unlinkURL\",\"casesForm\",confirmUnlink)", '', '', "title='{$this->lang->testtask->unlinkCase}' class='btn-icon'"); diff --git a/module/user/config.php b/module/user/config.php index 47ab768e3e..b4211a351f 100644 --- a/module/user/config.php +++ b/module/user/config.php @@ -6,8 +6,8 @@ $config->user->edit = new stdclass(); $config->user->create->requiredFields = 'account,realname,password,password1,password2'; $config->user->edit->requiredFields = 'account,realname'; -$config->user->customBatchCreateFields = 'dept,email,gender,commiter,join,skype,qq,yahoo,gtalk,wangwang,mobile,phone,address,zipcode,limitedUser'; -$config->user->customBatchEditFields = 'dept,email,commiter,join,skype,qq,yahoo,gtalk,wangwang,mobile,phone,address,zipcode,limitedUser'; +$config->user->customBatchCreateFields = 'dept,email,gender,commiter,join,skype,qq,yahoo,gtalk,wangwang,mobile,phone,address,zipcode'; +$config->user->customBatchEditFields = 'dept,email,commiter,join,skype,qq,yahoo,gtalk,wangwang,mobile,phone,address,zipcode'; $config->user->custom = new stdclass(); $config->user->custom->batchCreateFields = 'dept,email,gender'; diff --git a/module/user/lang/zh-cn.php b/module/user/lang/zh-cn.php index f9a04cff6e..1784f91a34 100644 --- a/module/user/lang/zh-cn.php +++ b/module/user/lang/zh-cn.php @@ -68,16 +68,16 @@ $lang->user->asGuest = "游客访问"; $lang->user->goback = "返回前一页"; $lang->user->deleted = '(已删除)'; -$lang->user->profile = '档案'; -$lang->user->project = $lang->projectCommon; -$lang->user->task = '任务'; -$lang->user->bug = '缺陷'; -$lang->user->test = '测试'; -$lang->user->testTask = '测试任务'; -$lang->user->testCase = '测试用例'; -$lang->user->todo = '待办'; -$lang->user->story = '需求'; -$lang->user->dynamic = '动态'; +$lang->user->profile = '档案'; +$lang->user->project = $lang->projectCommon; +$lang->user->task = '任务'; +$lang->user->bug = '缺陷'; +$lang->user->test = '测试'; +$lang->user->testTask = '测试任务'; +$lang->user->testCase = '测试用例'; +$lang->user->todo = '待办'; +$lang->user->story = '需求'; +$lang->user->dynamic = '动态'; $lang->user->openedBy = '由他创建'; $lang->user->assignedTo = '指派给他'; @@ -97,10 +97,6 @@ $lang->user->lockWarning = "您还有%s次尝试机会。"; $lang->user->loginLocked = "密码尝试次数太多,请联系管理员解锁,或%s分钟后重试。"; $lang->user->weakPassword = "您的密码强度小于系统设定。"; -$lang->user->limitedUser = '受限用户'; -$lang->user->limitedUserList['no'] = '否'; -$lang->user->limitedUserList['yes'] = '是'; - $lang->user->roleList[''] = ''; $lang->user->roleList['dev'] = '研发'; $lang->user->roleList['qa'] = '测试'; @@ -138,7 +134,6 @@ $lang->user->placeholder->role = '职位影响内容和用户列表的顺 $lang->user->placeholder->group = '分组决定用户的权限列表。'; $lang->user->placeholder->commiter = '版本控制系统(subversion)中的帐号'; $lang->user->placeholder->verify = '需要输入你的密码加以验证'; -$lang->user->placeholder->limitedUser = '只能编辑与自己相关的内容。'; $lang->user->placeholder->passwordStrength[1] = '6位以上,包含大小写字母,数字。'; $lang->user->placeholder->passwordStrength[2] = '10位以上,包含大小写字母,数字,特殊字符。'; diff --git a/module/user/model.php b/module/user/model.php index 1f2ed14d4a..7d6db0fc7f 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -298,8 +298,6 @@ class userModel extends model $data[$i]->address = $users->address[$i]; $data[$i]->zipcode = $users->zipcode[$i]; - $data[$i]->limitedUser = $users->limitedUser[$i]; - /* Change for append field, such as feedback.*/ if(!empty($this->config->user->batchAppendFields)) { @@ -467,7 +465,6 @@ class userModel extends model $users[$id]['phone'] = $data->phone[$id]; $users[$id]['address'] = $data->address[$id]; $users[$id]['zipcode'] = $data->zipcode[$id]; - $users[$id]['limitedUser'] = $data->limitedUser[$id]; $users[$id]['dept'] = $data->dept[$id] == 'ditto' ? (isset($prev['dept']) ? $prev['dept'] : 0) : $data->dept[$id]; $users[$id]['role'] = $data->role[$id] == 'ditto' ? (isset($prev['role']) ? $prev['role'] : 0) : $data->role[$id]; diff --git a/module/user/view/batchcreate.html.php b/module/user/view/batchcreate.html.php index 1a06e6e8ca..9065295a57 100644 --- a/module/user/view/batchcreate.html.php +++ b/module/user/view/batchcreate.html.php @@ -55,7 +55,6 @@ $minWidth = (count($visibleFields) > 5) ? 'w-150px' : ''; - $lang->user->ditto)?> @@ -90,7 +89,6 @@ $minWidth = (count($visibleFields) > 5) ? 'w-150px' : ''; - diff --git a/module/user/view/batchedit.html.php b/module/user/view/batchedit.html.php index c3a89db2ed..ee2624613e 100644 --- a/module/user/view/batchedit.html.php +++ b/module/user/view/batchedit.html.php @@ -51,7 +51,6 @@ $minWidth = (count($visibleFields) > 7) ? 'w-120px' : ''; - $lang->user->ditto) + $depts;?> @@ -81,7 +80,6 @@ $minWidth = (count($visibleFields) > 7) ? 'w-120px' : ''; - diff --git a/module/user/view/create.html.php b/module/user/view/create.html.php index db58bf376d..95d34dd32f 100644 --- a/module/user/view/create.html.php +++ b/module/user/view/create.html.php @@ -61,11 +61,6 @@ - - - - - diff --git a/module/user/view/edit.html.php b/module/user/view/edit.html.php index 30f6be8ccd..17d2d1a414 100644 --- a/module/user/view/edit.html.php +++ b/module/user/view/edit.html.php @@ -71,8 +71,6 @@ - -
bug->openedBy;?> openedBy] . $lang->at . $bug->openedDate;?> openedBy) . $lang->at . $bug->openedDate;?>
bug->openedBuild;?>
bug->lblResolved;?>resolvedBy) echo $users[$bug->resolvedBy] . $lang->at . $bug->resolvedDate;?>resolvedBy) echo zget($users, $bug->resolvedBy) . $lang->at . $bug->resolvedDate;?>
bug->resolvedBuild;?>
bug->closedBy;?>closedBy) echo $users[$bug->closedBy] . $lang->at . $bug->closedDate;?>closedBy) echo zget($users, $bug->closedBy) . $lang->at . $bug->closedDate;?>
bug->lblLastEdited;?>user->join);?> user->last);?> user->visits);?>user->limitedUser);?> actions;?>
join;?> last) echo date('Y-m-d', $user->last);?> visits;?>user->limitedUserList[$user->limitedUser];?> id&from=company", '', 'list'); @@ -96,7 +94,7 @@ js::set('confirmDelete', $lang->user->confirmDelete);
+
resource->my->changePassword = 'changePassword'; $lang->resource->my->unbind = 'unbind'; $lang->resource->my->manageContacts = 'manageContacts'; $lang->resource->my->deleteContacts = 'deleteContacts'; +$lang->resource->my->limited = 'limited'; $lang->my->methodOrder[0] = 'index'; $lang->my->methodOrder[5] = 'todo'; @@ -100,6 +101,7 @@ $lang->my->methodOrder[55] = 'changePassword'; $lang->my->methodOrder[60] = 'unbind'; $lang->my->methodOrder[65] = 'manageContacts'; $lang->my->methodOrder[75] = 'deleteContacts'; +$lang->my->methodOrder[80] = 'limited'; /* Todo. */ $lang->resource->todo = new stdclass(); diff --git a/module/my/lang/en.php b/module/my/lang/en.php index bd3caf6e82..eea0299035 100644 --- a/module/my/lang/en.php +++ b/module/my/lang/en.php @@ -17,6 +17,7 @@ $lang->my->changePassword = 'Edit Password'; $lang->my->unbind = 'Unbind Ranger'; $lang->my->manageContacts = 'Maintain Contact'; $lang->my->deleteContacts = 'Delete Contact'; +$lang->my->limited = 'Restricted operation (editing only content related to itself)'; $lang->my->taskMenu = new stdclass(); $lang->my->taskMenu->assignedToMe = 'Assigned to Me'; diff --git a/module/my/lang/zh-cn.php b/module/my/lang/zh-cn.php index 30c2350f86..5cc94ef9e7 100644 --- a/module/my/lang/zh-cn.php +++ b/module/my/lang/zh-cn.php @@ -17,6 +17,7 @@ $lang->my->changePassword = '修改密码'; $lang->my->unbind = '解除然之绑定'; $lang->my->manageContacts = '维护联系人'; $lang->my->deleteContacts = '删除联系人'; +$lang->my->limited = '受限操作(只能编辑与自己相关的内容)'; $lang->my->taskMenu = new stdclass(); $lang->my->taskMenu->assignedToMe = '指派给我'; diff --git a/module/my/view/profile.html.php b/module/my/view/profile.html.php index 666e0c54bd..65d9a20ae0 100644 --- a/module/my/view/profile.html.php +++ b/module/my/view/profile.html.php @@ -54,10 +54,6 @@
group->priv;?> name . ' '; ?>
user->limitedUser;?>user->limitedUserList[$user->limitedUser];?>
user->commiter;?> commiter;?> id}&story={$story->id}&moduleID={$story->module}"; $lang->task->create = $lang->project->wbs; @@ -129,16 +130,16 @@ } else { - if(!$limitedUser) common::printIcon('task', 'create', $param, $story, 'list', 'plus-border', '', 'btn-task-create'); + if($hasDBPriv) common::printIcon('task', 'create', $param, '', 'list', 'plus-border', '', 'btn-task-create'); } $lang->task->batchCreate = $lang->project->batchWBS; - if(!$limitedUser) common::printIcon('task', 'batchCreate', "projectID={$project->id}&story={$story->id}", $story, 'list', 'plus-sign'); + if($hasDBPriv) common::printIcon('task', 'batchCreate', "projectID={$project->id}&story={$story->id}", '', 'list', 'plus-sign'); $lang->testcase->batchCreate = $lang->testcase->create; - if($productID && !$limitedUser) common::printIcon('testcase', 'batchCreate', "productID=$story->product&branch=$story->branch&moduleID=$story->module&storyID=$story->id", $story, 'list', 'sitemap'); + if($productID && $hasDBPriv) common::printIcon('testcase', 'batchCreate', "productID=$story->product&branch=$story->branch&moduleID=$story->module&storyID=$story->id", '', 'list', 'sitemap'); - if(common::hasPriv('project', 'unlinkStory') && !$limitedUser) + if(common::hasPriv('project', 'unlinkStory', $project)) { $unlinkURL = $this->createLink('project', 'unlinkStory', "projectID=$project->id&storyID=$story->id&confirm=yes"); echo html::a("javascript:ajaxDelete(\"$unlinkURL\",\"storyList\",confirmUnlinkStory)", '', '', "class='btn-icon' title='{$lang->project->unlinkStory}'"); diff --git a/module/project/view/taskheader.html.php b/module/project/view/taskheader.html.php index 21227f499c..214756f2ab 100644 --- a/module/project/view/taskheader.html.php +++ b/module/project/view/taskheader.html.php @@ -126,16 +126,15 @@ $misc = common::hasPriv('task', 'create', $project) ? "class='btn btn-primary'" : "class='btn btn-primary disabled'"; $link = common::hasPriv('task', 'create', $project) ? $this->createLink('task', 'create', "project=$projectID" . (isset($moduleID) ? "&storyID=&moduleID=$moduleID" : '')) : '#'; echo html::a($link, "" . $lang->task->create, '', $misc); + + $misc = common::hasPriv('task', 'batchCreate', $project) ? '' : "disabled"; + $link = common::hasPriv('task', 'batchCreate', $project) ? $this->createLink('task', 'batchCreate', "project=$projectID" . (isset($moduleID) ? "&storyID=&moduleID=$moduleID" : '')) : '#'; ?> - diff --git a/module/project/view/team.html.php b/module/project/view/team.html.php index f8e7464106..0857965a6a 100644 --- a/module/project/view/team.html.php +++ b/module/project/view/team.html.php @@ -27,7 +27,7 @@ } else { - if($app->user->limitedUser === 'no') common::printLink('project', 'managemembers', "projectID=$project->id", $lang->project->manageMembers, '', "class='btn btn-primary manage-team-btn'"); + if(!empty($app->user->admin) or empty($app->user->rights['rights']['my']['limited'])) common::printLink('project', 'managemembers', "projectID=$project->id", $lang->project->manageMembers, '', "class='btn btn-primary manage-team-btn'"); } ?> diff --git a/module/release/model.php b/module/release/model.php index 728a02ae97..d7fdf1153d 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -319,19 +319,4 @@ class releaseModel extends model $this->dao->update(TABLE_RELEASE)->set('status')->eq($status)->where('id')->eq($releaseID)->exec(); return dao::isError(); } - - /** - * Judge an action is clickable or not. - *- - * @param object $product- - * @param string $action- - * @access public - * @return void - */ - public static function isClickable($release, $action) - { - if(!common::limitedUser($release)) return false; - - return true; - } } diff --git a/module/story/model.php b/module/story/model.php index 645cbc5dd0..e905fa662c 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2186,8 +2186,6 @@ class storyModel extends model { $action = strtolower($action); - if(!common::limitedUser($story)) return false; - if($action == 'change') return $story->status != 'closed'; if($action == 'review') return $story->status == 'draft' or $story->status == 'changed'; if($action == 'close') return $story->status != 'closed'; diff --git a/module/task/model.php b/module/task/model.php index 89374ed707..35401a9079 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -1613,8 +1613,6 @@ class taskModel extends model { $action = strtolower($action); - if(!common::limitedUser($task, 'task')) return false; - if($action == 'assignto') return $task->status != 'closed' and $task->status != 'cancel'; if($action == 'start') return $task->status == 'wait'; if($action == 'restart') return $task->status == 'pause'; @@ -1774,7 +1772,7 @@ class taskModel extends model } common::printIcon('task', 'finish', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); common::printIcon('task', 'close', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); - common::printIcon('task', 'edit',"taskID=$task->id", '', 'list'); + common::printIcon('task', 'edit',"taskID=$task->id", $task, 'list'); break; } echo ' '> user->phone;?> '> user->address;?> '> user->zipcode;?>'> user->limitedUser;?>
'> '> '> > user->limitedUserList, 'no');?>
'> user->phone;?> '> user->address;?> '> user->zipcode;?>'> user->limitedUser;?>
'> id]", $user->phone, "class='form-control' autocomplete='off'");?> '> id]", $user->address, "class='form-control' autocomplete='off'");?> '> id]", $user->zipcode, "class='form-control' autocomplete='off'");?>> id]", $lang->user->limitedUserList, $user->limitedUser);?>
user->placeholder->group?>
user->limitedUser;?>user->limitedUserList, 'no');?>user->placeholder->limitedUser?>
user->email;?>
user->commiter;?> commiter, "class='form-control' autocomplete='off'");?>user->limitedUser;?>user->limitedUserList, $user->limitedUser);?>