Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
dd0ccd04
Commit
dd0ccd04
authored
16 years ago
by
Dennis Waldron
Browse files
Options
Downloads
Patches
Plain Diff
Modified to also give select rights on VIEWS
parent
f5c01e34
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
castor/db/grant_oracle_user.sql
+15
-9
15 additions, 9 deletions
castor/db/grant_oracle_user.sql
with
15 additions
and
9 deletions
castor/db/grant_oracle_user.sql
+
15
−
9
View file @
dd0ccd04
...
...
@@ -17,10 +17,10 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* @(#)$RCSfile: grant_oracle_user.sql,v $ $Release: 1.2 $ $Release$ $Date: 2009/03/0
4
1
4
:0
7:19
$ $Author: waldron $
* @(#)$RCSfile: grant_oracle_user.sql,v $ $Release: 1.2 $ $Release$ $Date: 2009/03/0
6
1
5
:0
5:48
$ $Author: waldron $
*
* This script grants SELECT rights on all tables within a database
schema
* to a given user.
* This script grants SELECT rights on all tables
and views
within a database
*
schema
to a given user.
*
* @author Castor Dev team, castor-dev@cern.ch
*****************************************************************************/
...
...
@@ -28,9 +28,9 @@
/* Stop on errors - this only works from sqlplus */
WHENEVER
SQLERROR
EXIT
FAILURE
;
/* Determine the user to grant SELECT rights on all tables */
/* Determine the user to grant SELECT rights on all tables
and views
*/
UNDEF
username
ACCEPT
username
DEFAULT
castor_read
PROMPT
'Grant SELECT rights on all tables to user: (castor_read) '
ACCEPT
username
DEFAULT
castor_read
PROMPT
'Grant SELECT rights on all tables
and views
to user: (castor_read) '
SET
VER
OFF
DECLARE
...
...
@@ -40,15 +40,21 @@ BEGIN
BEGIN
SELECT
username
INTO
unused
FROM
all_users
WHERE
lower
(
username
)
=
'&&username'
;
WHERE
username
=
upper
(
'&&username'
)
;
EXCEPTION
WHEN
NO_DATA_FOUND
THEN
raise_application_error
(
-
20000
,
'User &username does not exist'
);
END
;
-- Grant select on all tables excluding temporary ones to username
FOR
a
IN
(
SELECT
table_name
FROM
user_tables
WHERE
temporary
=
'N'
)
-- Grant select on all tables and views excluding temporary ones to username
FOR
a
IN
(
SELECT
table_name
FROM
user_tables
WHERE
temporary
=
'N'
UNION
ALL
SELECT
view_name
FROM
user_views
)
LOOP
EXECUTE
IMMEDIATE
'GRANT SELECT ON '
||
a
.
table_name
||
' TO &username'
;
IF
a
.
table_name
IN
(
'DLF_CONFIG'
,
'DLF_MONITORING'
)
THEN
EXECUTE
IMMEDIATE
'GRANT SELECT ON '
||
a
.
table_name
||
' TO &username WITH GRANT OPTION'
;
ELSE
EXECUTE
IMMEDIATE
'GRANT SELECT ON '
||
a
.
table_name
||
' TO &username'
;
END
IF
;
END
LOOP
;
END
;
/
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment