Skip to content

Commit f33dd27

Browse files
author
Peter Ocelka
committed
added for #658
1 parent 27e842e commit f33dd27

File tree

2 files changed

+229
-0
lines changed

2 files changed

+229
-0
lines changed

source/create_user_grants.sql

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/*
2+
utPLSQL - Version 3
3+
Copyright 2016 - 2017 utPLSQL Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License"):
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
17+
Create all necessary grant for the user who owns test packages and want to execute utPLSQL framework
18+
*/
19+
20+
@@define_ut3_owner_param.sql
21+
22+
column 2 new_value 2 noprint
23+
select null as "2" from dual where 1=0;
24+
spool params.sql.tmp
25+
select
26+
case
27+
when '&&2' is null then q'[ACCEPT ut3_user CHAR PROMPT 'Provide schema to which should be granted the utPLSQL v3 ']'
28+
else 'define ut3_user=&&2'
29+
end
30+
from dual;
31+
spool off
32+
set termout on
33+
@params.sql.tmp
34+
set termout off
35+
/* cleanup temporary sql files */
36+
--try running on windows
37+
$ del params.sql.tmp
38+
--try running on linux/unix
39+
! rm params.sql.tmp
40+
set termout on
41+
42+
set echo off
43+
set feedback on
44+
set heading off
45+
set verify off
46+
47+
prompt Granting privileges on UTPLSQL objects in &&ut3_owner schema to user &&ut3_user
48+
49+
whenever sqlerror exit failure rollback
50+
whenever oserror exit failure rollback
51+
52+
alter session set current_schema = &&ut3_owner;
53+
54+
grant execute on &&ut3_owner..ut_be_between to &ut3_user;
55+
grant execute on &&ut3_owner..ut_be_empty to &ut3_user;
56+
grant execute on &&ut3_owner..ut_be_false to &ut3_user;
57+
grant execute on &&ut3_owner..ut_be_greater_or_equal to &ut3_user;
58+
grant execute on &&ut3_owner..ut_be_greater_than to &ut3_user;
59+
grant execute on &&ut3_owner..ut_be_less_or_equal to &ut3_user;
60+
grant execute on &&ut3_owner..ut_be_less_than to &ut3_user;
61+
grant execute on &&ut3_owner..ut_be_like to &ut3_user;
62+
grant execute on &&ut3_owner..ut_be_not_null to &ut3_user;
63+
grant execute on &&ut3_owner..ut_be_null to &ut3_user;
64+
grant execute on &&ut3_owner..ut_be_true to &ut3_user;
65+
grant execute on &&ut3_owner..ut_equal to &ut3_user;
66+
grant execute on &&ut3_owner..ut_have_count to &ut3_user;
67+
grant execute on &&ut3_owner..ut_match to &ut3_user;
68+
grant execute on &&ut3_owner..ut to &ut3_user;
69+
grant execute on &&ut3_owner..ut_runner to &ut3_user;
70+
grant execute on &&ut3_owner..ut_teamcity_reporter to &ut3_user;
71+
grant execute on &&ut3_owner..ut_xunit_reporter to &ut3_user;
72+
grant execute on &&ut3_owner..ut_junit_reporter to &ut3_user;
73+
grant execute on &&ut3_owner..ut_tfs_junit_reporter to &ut3_user;
74+
grant execute on &&ut3_owner..ut_documentation_reporter to &ut3_user;
75+
grant execute on &&ut3_owner..ut_coverage_html_reporter to &ut3_user;
76+
grant execute on &&ut3_owner..ut_coverage_sonar_reporter to &ut3_user;
77+
grant execute on &&ut3_owner..ut_coveralls_reporter to &ut3_user;
78+
grant execute on &&ut3_owner..ut_coverage_cobertura_reporter to &ut3_user;
79+
grant execute on &&ut3_owner..ut_reporters to &ut3_user;
80+
grant execute on &&ut3_owner..ut_varchar2_list to &ut3_user;
81+
grant execute on &&ut3_owner..ut_varchar2_rows to &ut3_user;
82+
grant execute on &&ut3_owner..ut_integer_list to &ut3_user;
83+
grant execute on &&ut3_owner..ut_reporter_base to &ut3_user;
84+
grant execute on &&ut3_owner..ut_output_reporter_base to &ut3_user;
85+
grant execute on &&ut3_owner..ut_coverage_reporter_base to &ut3_user;
86+
grant execute on &&ut3_owner..ut_console_reporter_base to &ut3_user;
87+
grant execute on &&ut3_owner..ut_coverage to &ut3_user;
88+
grant execute on &&ut3_owner..ut_coverage_options to &ut3_user;
89+
grant execute on &&ut3_owner..ut_coverage_helper to &ut3_user;
90+
grant execute on &&ut3_owner..ut_output_buffer_base to &ut3_user;
91+
grant execute on &&ut3_owner..ut_output_table_buffer to &ut3_user;
92+
grant execute on &&ut3_owner..ut_file_mappings to &ut3_user;
93+
grant execute on &&ut3_owner..ut_file_mapping to &ut3_user;
94+
grant execute on &&ut3_owner..ut_file_mapper to &ut3_user;
95+
grant execute on &&ut3_owner..ut_key_value_pairs to &ut3_user;
96+
grant execute on &&ut3_owner..ut_key_value_pair to &ut3_user;
97+
grant select, insert, delete on &&ut3_owner..ut_compound_data_tmp to &ut3_user;
98+
grant select, insert, delete on &&ut3_owner..ut_compound_data_diff_tmp to &ut3_user;
99+
grant execute on &&ut3_owner..ut_sonar_test_reporter to &ut3_user;
100+
grant execute on &&ut3_owner..ut_annotations to &ut3_user;
101+
grant execute on &&ut3_owner..ut_annotation to &ut3_user;
102+
grant execute on &&ut3_owner..ut_annotation_manager to &ut3_user;
103+
grant execute on &&ut3_owner..ut_annotated_object to &ut3_user;
104+
grant execute on &&ut3_owner..ut_annotated_objects to &ut3_user;
105+
grant select on &&ut3_owner..ut_annotation_cache_info to &ut3_user;
106+
grant select on &&ut3_owner..ut_annotation_cache to &ut3_user;
107+
grant execute on &&ut3_owner..ut_annotation_cache_manager to &ut3_user;
108+
grant execute on &&ut3_owner..ut_annotation_parser to &ut3_user;
109+
grant execute on &&ut3_owner..ut_annotation_objs_cache_info to &ut3_user;
110+
grant execute on &&ut3_owner..ut_annotation_obj_cache_info to &ut3_user;
111+
begin
112+
$if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
113+
execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_blocks to &ut3_user';
114+
execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_runs to &ut3_user';
115+
execute immediate 'grant select, insert, delete, update on &&ut3_owner..dbmspcc_units to &ut3_user';
116+
$else
117+
null;
118+
$end
119+
end;
120+
/

source/create_user_synonyms.sql

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
/*
2+
utPLSQL - Version 3
3+
Copyright 2016 - 2017 utPLSQL Project
4+
5+
Licensed under the Apache License, Version 2.0 (the "License"):
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
17+
Create all necessary grant for the user who owns test packages and want to execute utPLSQL framework
18+
*/
19+
20+
@@define_ut3_owner_param.sql
21+
22+
column 2 new_value 2 noprint
23+
select null as "2" from dual where 1=0;
24+
spool params.sql.tmp
25+
select
26+
case
27+
when '&&2' is null then q'[ACCEPT ut3_user CHAR PROMPT 'Provide schema name where synonyms for the utPLSQL v3 should be created ']'
28+
else 'define ut3_user=&&2'
29+
end
30+
from dual;
31+
spool off
32+
set termout on
33+
@params.sql.tmp
34+
set termout off
35+
/* cleanup temporary sql files */
36+
--try running on windows
37+
$ del params.sql.tmp
38+
--try running on linux/unix
39+
! rm params.sql.tmp
40+
set termout on
41+
42+
set echo off
43+
set feedback on
44+
set heading off
45+
set verify off
46+
47+
prompt Granting privileges on UTPLSQL objects in &&ut3_owner schema to user &&ut3_user
48+
49+
whenever sqlerror exit failure rollback
50+
whenever oserror exit failure rollback
51+
52+
alter session set current_schema = &&ut3_owner;
53+
54+
prompt Creating synonyms for UTPLSQL objects in &&ut3_owner schema to user &&ut3_user
55+
56+
create or replace synonym &ut3_user..be_between for &&ut3_owner..be_between;
57+
create or replace synonym &ut3_user..be_empty for &&ut3_owner..be_empty;
58+
create or replace synonym &ut3_user..be_false for &&ut3_owner..be_false;
59+
create or replace synonym &ut3_user..be_greater_or_equal for &&ut3_owner..be_greater_or_equal;
60+
create or replace synonym &ut3_user..be_greater_than for &&ut3_owner..be_greater_than;
61+
create or replace synonym &ut3_user..be_less_or_equal for &&ut3_owner..be_less_or_equal;
62+
create or replace synonym &ut3_user..be_less_than for &&ut3_owner..be_less_than;
63+
create or replace synonym &ut3_user..be_like for &&ut3_owner..be_like;
64+
create or replace synonym &ut3_user..be_not_null for &&ut3_owner..be_not_null;
65+
create or replace synonym &ut3_user..be_null for &&ut3_owner..be_null;
66+
create or replace synonym &ut3_user..be_true for &&ut3_owner..be_true;
67+
create or replace synonym &ut3_user..equal for &&ut3_owner..equal;
68+
create or replace synonym &ut3_user..have_count for &&ut3_owner..have_count;
69+
create or replace synonym &ut3_user..match for &&ut3_owner..match;
70+
create or replace synonym &ut3_user..ut for &&ut3_owner..ut;
71+
create or replace synonym &ut3_user..ut_runner for &&ut3_owner..ut_runner;
72+
create or replace synonym &ut3_user..ut_teamcity_reporter for &&ut3_owner..ut_teamcity_reporter;
73+
create or replace synonym &ut3_user..ut_xunit_reporter for &&ut3_owner..ut_xunit_reporter;
74+
create or replace synonym &ut3_user..ut_junit_reporter for &&ut3_owner..ut_junit_reporter;
75+
create or replace synonym &ut3_user..ut_tfs_junit_reporter for &&ut3_owner..ut_tfs_junit_reporter;
76+
create or replace synonym &ut3_user..ut_documentation_reporter for &&ut3_owner..ut_documentation_reporter;
77+
create or replace synonym &ut3_user..ut_coverage_html_reporter for &&ut3_owner..ut_coverage_html_reporter;
78+
create or replace synonym &ut3_user..ut_coverage_sonar_reporter for &&ut3_owner..ut_coverage_sonar_reporter;
79+
create or replace synonym &ut3_user..ut_coveralls_reporter for &&ut3_owner..ut_coveralls_reporter;
80+
create or replace synonym &ut3_user..ut_coverage_cobertura_reporter for &&ut3_owner..ut_coverage_cobertura_reporter;
81+
create or replace synonym &ut3_user..ut_reporters for &&ut3_owner..ut_reporters;
82+
create or replace synonym &ut3_user..ut_varchar2_list for &&ut3_owner..ut_varchar2_list;
83+
create or replace synonym &ut3_user..ut_varchar2_rows for &&ut3_owner..ut_varchar2_rows;
84+
create or replace synonym &ut3_user..ut_integer_list for &&ut3_owner..ut_integer_list;
85+
create or replace synonym &ut3_user..ut_reporter_base for &&ut3_owner..ut_reporter_base;
86+
create or replace synonym &ut3_user..ut_output_reporter_base for &&ut3_owner..ut_output_reporter_base;
87+
create or replace synonym &ut3_user..ut_coverage for &&ut3_owner..ut_coverage;
88+
create or replace synonym &ut3_user..ut_coverage_options for &&ut3_owner..ut_coverage_options;
89+
create or replace synonym &ut3_user..ut_coverage_helper for &&ut3_owner..ut_coverage_helper;
90+
create or replace synonym &ut3_user..ut_output_buffer_base for &&ut3_owner..ut_output_buffer_base;
91+
create or replace synonym &ut3_user..ut_output_table_buffer for &&ut3_owner..ut_output_table_buffer;
92+
create or replace synonym &ut3_user..ut_file_mappings for &&ut3_owner..ut_file_mappings;
93+
create or replace synonym &ut3_user..ut_file_mapping for &&ut3_owner..ut_file_mapping;
94+
create or replace synonym &ut3_user..ut_file_mapper for &&ut3_owner..ut_file_mapper;
95+
create or replace synonym &ut3_user..ut_key_value_pairs for &&ut3_owner..ut_key_value_pairs;
96+
create or replace synonym &ut3_user..ut_key_value_pair for &&ut3_owner..ut_key_value_pair;
97+
create or replace synonym &ut3_user..ut_compound_data_tmp for &&ut3_owner..ut_cursor_data;
98+
create or replace synonym &ut3_user..ut_compound_data_diff_tmp for &&ut3_owner..ut_compound_data_diff_tmp;
99+
create or replace synonym &ut3_user..ut_sonar_test_reporter for &&ut3_owner..ut_sonar_test_reporter;
100+
begin
101+
$if dbms_db_version.version = 12 and dbms_db_version.release >= 2 or dbms_db_version.version > 12 $then
102+
execute immediate 'create or replace synonym &ut3_user..dbmspcc_blocks for &&ut3_owner..dbmspcc_blocks';
103+
execute immediate 'create or replace synonym &ut3_user..dbmspcc_runs for &&ut3_owner..dbmspcc_runs';
104+
execute immediate 'create or replace synonym &ut3_user..dbmspcc_units for &&ut3_owner..dbmspcc_units';
105+
$else
106+
null;
107+
$end
108+
end;
109+
/

0 commit comments

Comments
 (0)