Skip to content
Permalink
Browse files

feature: #0008655: new right to allow add/remove keywords from execut…

…ed test case versions
  • Loading branch information...
fmancardi committed May 4, 2019
1 parent 0db4b78 commit 1ab585425abdbca4e3bebbfa86f9b569f6fc0138
@@ -51,7 +51,8 @@ var {$opt_cfg->js_ot_name} = new OptionTransfer("{$opt_cfg->from->name}","{$opt_

{include file="opt_transfer.inc.tpl" option_transfer=$opt_cfg}
<br />
{if $gui->hasBeenExecuted == 0}
{if $gui->hasBeenExecuted == 0 ||
$gui->canAddRemoveKWFromExecuted == 1}
<input type="submit" name="assign{$gui->level}" id="assign{$gui->level}" value="{$labels.btn_save}" />
{else}
{$labels.tcversion_executed_keyword_assignment_blocked}
@@ -7,6 +7,9 @@
# From TestLink 1.9.19 to 1.9.20
#
#
-- since 1.9.20
INSERT INTO /*prefix*/rights (id,description) VALUES (55,'testproject_add_remove_keywords_executed_tcversions');

#
CREATE OR REPLACE VIEW /*prefix*/latest_exec_by_testplan
AS SELECT tcversion_id, testplan_id, MAX(id) AS id
@@ -3,6 +3,9 @@
--
-- SQL script - Postgres

-- since 1.9.20
INSERT INTO /*prefix*/rights (id,description) VALUES (55,'testproject_add_remove_keywords_executed_tcversions');

--
--
CREATE OR REPLACE VIEW /*prefix*/latest_exec_by_testplan AS
@@ -101,6 +101,10 @@ INSERT INTO /*prefix*/rights (id,description) VALUES (52,'codetracker_view');
INSERT INTO /*prefix*/rights (id,description) VALUES (53,'cfield_assignment');
INSERT INTO /*prefix*/rights (id,description) VALUES (54,'exec_assign_testcases');

-- since 1.9.20
INSERT INTO /*prefix*/rights (id,description) VALUES (55,'testproject_add_remove_keywords_executed_tcversions');


SET IDENTITY_INSERT /*prefix*/rights OFF

-- Rights for Administrator role
@@ -98,6 +98,9 @@ INSERT INTO /*prefix*/rights (id,description) VALUES (52,'codetracker_view');
INSERT INTO /*prefix*/rights (id,description) VALUES (53,'cfield_assignment');
INSERT INTO /*prefix*/rights (id,description) VALUES (54,'exec_assign_testcases');

-- since 1.9.20
INSERT INTO /*prefix*/rights (id,description) VALUES (55,'testproject_add_remove_keywords_executed_tcversions');

# Rights for Administrator role
INSERT INTO /*prefix*/role_rights (role_id,right_id) VALUES (8,1 );
INSERT INTO /*prefix*/role_rights (role_id,right_id) VALUES (8,2 );
@@ -102,6 +102,9 @@ INSERT INTO /*prefix*/rights (id,description) VALUES (52,'codetracker_view');
INSERT INTO /*prefix*/rights (id,description) VALUES (53,'cfield_assignment');
INSERT INTO /*prefix*/rights (id,description) VALUES (54,'exec_assign_testcases');

-- since 1.9.20
INSERT INTO /*prefix*/rights (id,description) VALUES (55,'testproject_add_remove_keywords_executed_tcversions');

-- Rights for Administrator (admin role)
INSERT INTO /*prefix*/role_rights (role_id,right_id) VALUES (8,1 );
INSERT INTO /*prefix*/role_rights (role_id,right_id) VALUES (8,2 );
@@ -45,6 +45,7 @@
$opt_cfg->from->lbl = lang_get('available_kword');
$opt_cfg->from->map = $tproject_mgr->get_keywords_map($args->testproject_id);
switch($args->edit) {
case 'testsuite':
@@ -70,13 +71,15 @@
$result = 'ok';
$glOpt = array('output' => 'thin', 'active' => 1);
for($idx = 0; $idx < $loop2do; $idx++) {
$ltcv = $tcase_mgr->get_last_version_info($tcs[$idx],$glOpt);
$latestActiveVersionID = $ltcv['tcversion_id'];
$statusQuo = current($tcase_mgr->get_versions_status_quo($tcs[$idx],$latestActiveVersionID));
$hasBeenExecuted = intval($statusQuo['executed']) > 0;
if( $hasBeenExecuted == false ) {
if( $gui->canAddRemoveKWFromExecuted ||
$hasBeenExecuted == false ) {
if(is_null($args->keywordArray)) {
$tcase_mgr->deleteKeywords($tcs[$idx],$latestActiveVersionID);
}
@@ -107,7 +110,8 @@
$statusQuo = current($tcase_mgr->get_versions_status_quo($args->id,$latestActiveVersionID));
$gui->hasBeenExecuted = intval($statusQuo['executed']) > 0;
if($args->assignToTestCase && !$gui->hasBeenExecuted) {
if( $args->assignToTestCase &&
($gui->canAddRemoveKWFromExecuted || !$gui->hasBeenExecuted) ) {
$result = 'ok';
$tcase_mgr->setKeywords($args->id,$latestActiveVersionID,$args->keywordArray);
$doRecall = !is_null($args->keywordArray);
@@ -163,6 +167,7 @@ function init_args(&$opt_cfg) {
$args->keywordArray = explode(",",$args->keywordList);
}
$args->user = $_SESSION['currentUser'];
return $args;
}
@@ -177,6 +182,12 @@ function initializeGui(&$argsObj) {
$guiObj->id = $argsObj->id;
$guiObj->level = $argsObj->edit;
$guiObj->keyword_assignment_subtitle = null;
$guiObj->canAddRemoveKWFromExecuted =
$argsObj->user->hasRight($db,
'testproject_add_remove_keywords_executed_tcversions') ||
$argsObj->user->hasRight($db,'testproject_edit_executed_testcases');
return $guiObj;
}

0 comments on commit 1ab5854

Please sign in to comment.
You can’t perform that action at this time.