DBA Data[Home] [Help]

PACKAGE: DVSYS.DBMS_MACUTL

Source


1 PACKAGE       dbms_macutl AS
2 
3   /********************/
4   /* Global Constants */
5   /********************/
6   -- Yes constant for enabled and label_ind columns (Boolean TRUE)
7   g_yes CONSTANT VARCHAR2(1) := 'Y';
8   -- No constant for enabled and label_ind columns (Boolean FALSE)
9   g_no  CONSTANT VARCHAR2(1) := 'N';
10 
11   -- Factor audit_options: No audit
12   g_audit_off                       CONSTANT NUMBER := 0;
13   -- Factor audit_options: Always audit
14   g_audit_always                    CONSTANT NUMBER := POWER(2,0);
15   -- Factor audit_options: Audit if get_expr returns an error
16   g_audit_on_get_error              CONSTANT NUMBER := POWER(2,1);
17   -- Factor audit_options: Audit if get_expr is null
18   g_audit_on_get_null               CONSTANT NUMBER := POWER(2,2);
19   -- Factor audit_options: Audit if validation function returns error
20   g_audit_on_validate_error         CONSTANT NUMBER := POWER(2,3);
21   -- Factor audit_options: Audit if validation function is false
22   g_audit_on_validate_false         CONSTANT NUMBER := POWER(2,4);
23   -- Factor audit_options: Audit if no trust level
24   g_audit_on_trust_level_null       CONSTANT NUMBER := POWER(2,5);
25   -- Factor audit_options: Audit if trus level is negative
26   g_audit_on_trust_level_neg        CONSTANT NUMBER := POWER(2,6);
27 
28   -- Fail_options: Fail with message
29   g_fail_with_message   CONSTANT NUMBER := POWER(2,0);
30   -- Fail_options: Fail with message
31   g_fail_silently       CONSTANT NUMBER := POWER(2,1);
32 
33   -- Factor identify_by column: Fixed value in get_expr column
34   g_identify_by_constant    CONSTANT NUMBER := 0;
35   -- Factor identify_by column: Expression in get_expr column
36   g_identify_by_method      CONSTANT NUMBER := 1;
37   -- Factor identify_by column: Sub-factors via factor_link$ table
38   g_identify_by_factor      CONSTANT NUMBER := 2;
39   -- Factor identify_by session context
40   g_identify_by_context     CONSTANT NUMBER := 3;
41 
42   -- Factor identify_by column:  Expression and Rule Set via factor_expr$ table
43   -- g_identify_by_ruleset     CONSTANT NUMBER := 4;
44 
45   -- Factor eval_options: Evaluate once upon login
46   g_eval_on_session CONSTANT NUMBER := 0;
47   -- Factor eval_options: Re-evaluate on each access
48   g_eval_on_access  CONSTANT NUMBER := 1;
49   -- Factor eval_options: Evaluate once at database startup
50   g_eval_on_startup  CONSTANT NUMBER := 2;
51 
52   -- Factor labeled_by column: Factor's identities are labeled
53   g_labeled_by_self     CONSTANT NUMBER := 0;
54   -- Factor labeled_by column: Derive label from sub-factor and merge algorithm
55   g_labeled_by_factors  CONSTANT NUMBER := 1;
56 
57   -- Realm Objects: Wild card to indicate all object names or all object types
58   g_all_object CONSTANT VARCHAR2(1) := '%';
59 
60   -- Rule Set audit_options: No auditing
61   g_ruleset_audit_off            CONSTANT NUMBER := 0;
62   -- Rule Set audit_options: Audit on Rule Set failure
63   g_ruleset_audit_fail           CONSTANT NUMBER := POWER(2,0);
64   -- Rule Set audit_options: Audit on Rule Set success
65   g_ruleset_audit_success        CONSTANT NUMBER := POWER(2,1);
66 
67   -- Rule Set eval_options: Rule Set succeeds if all Rules are TRUE
68   g_ruleset_eval_all             CONSTANT NUMBER := 1;
69   -- Rule Set eval_options: Rule Set succeeds if any Rule is TRUE
70   g_ruleset_eval_any             CONSTANT NUMBER := 2;
71 
72   -- Rule Set fail_options: Show error message
73   g_ruleset_fail_show            CONSTANT NUMBER := 1;
74   -- Rule Set fail_options: No error message
75   g_ruleset_fail_silent          CONSTANT NUMBER := 2;
76 
77   -- Rule Set handler_options: No call to handler
78   g_ruleset_handler_off          CONSTANT NUMBER := 0;
79   -- Rule Set handler_options: Call handler on Rule Set failure
80   g_ruleset_handler_fail         CONSTANT NUMBER := POWER(2,0);
81   -- Rule Set handler_options: Call handler on Rule Set success
82   g_ruleset_handler_success      CONSTANT NUMBER := POWER(2,1);
83 
84   -- Realm audit_options: No auditing
85   g_realm_audit_off              CONSTANT NUMBER := 0;
86   -- Realm audit_options: Audit on realm violation
87   g_realm_audit_fail             CONSTANT NUMBER := POWER(2,0);
88   -- Realm audit_options: Audit on successful realm access
89   g_realm_audit_success          CONSTANT NUMBER := POWER(2,1);
90 
91   -- Realm authoriations: Participant
92   g_realm_auth_participant       CONSTANT NUMBER := 0;
93   -- Realm authoriations: Owner
94   g_realm_auth_owner             CONSTANT NUMBER := 1;
95 
96 
97   -- Code groups: Audit Event Descriptions
98   g_codes_audit_events    CONSTANT VARCHAR2(30) := 'AUDIT_EVENTS';
99   -- Code groups: Boolean values
100   g_codes_boolean         CONSTANT VARCHAR2(30) := 'BOOLEAN';
101   -- Code groups: DDL commands
102   g_codes_ddl_cmds        CONSTANT VARCHAR2(30) := 'DDL_CMDS';
103   -- Code groups: Factor audit_options
104   g_codes_factor_audit    CONSTANT VARCHAR2(30) := 'FACTOR_AUDIT';
105   -- Code groups: Factor eval_options
106   g_codes_factor_eval     CONSTANT VARCHAR2(30) := 'FACTOR_EVALUATE';
107   -- Code groups: Factor fail_options
108   g_codes_factor_fail     CONSTANT VARCHAR2(30) := 'FACTOR_FAIL';
109   -- Code groups: Factor identity_by
110   g_codes_factor_identify CONSTANT VARCHAR2(30) := 'FACTOR_IDENTIFY';
111   -- Code groups: Factor labeled_by
112   g_codes_factor_label    CONSTANT VARCHAR2(30) := 'FACTOR_LABEL';
113   -- Code groups: Database object types
114   g_codes_db_object_type  CONSTANT VARCHAR2(30) := 'DB_OBJECT_TYPE';
115   -- Code groups: OLS Policy merge algorithms
116   g_codes_label_alg       CONSTANT VARCHAR2(30) := 'LABEL_ALG';
117   -- Code groups: DV Error messages
118   g_codes_messages        CONSTANT VARCHAR2(30) := 'DV_MESSAGES';
119   -- Code groups: SQL relational operators
120   g_codes_operators       CONSTANT VARCHAR2(30) := 'OPERATORS';
121   -- Code groups: Realm audit_options
122   g_codes_realm_audit     CONSTANT VARCHAR2(30) := 'REALM_AUDIT';
123   -- Code groups: Rule Set audit_options
124   g_codes_ruleset_audit   CONSTANT VARCHAR2(30) := 'RULESET_AUDIT';
125   -- Code groups: Rule Set evaluate_options
126   g_codes_ruleset_eval    CONSTANT VARCHAR2(30) := 'RULESET_EVALUATE';
127   -- Code groups: Rule Set handler_options
128   g_codes_ruleset_event   CONSTANT VARCHAR2(30) := 'RULESET_EVENT';
129   -- Code groups: Rule Set fail_options
130   g_codes_ruleset_fail    CONSTANT VARCHAR2(30) := 'RULESET_FAIL';
131   -- Code groups: SQL Commands
132   g_codes_sql_cmds        CONSTANT VARCHAR2(30) := 'SQL_CMDS';
133 
134   -- Context:   Namespace, Attribute, Value
135   -- MACSEC/MACOLS context start with this
136   g_context_prefix CONSTANT VARCHAR2(30) := 'MAC$';
137   -- Factor Labels:    MAC$F$<policy>, <factor_name>, <factor label>
138   g_context_factor_label CONSTANT VARCHAR2(30) := g_context_prefix||'F$';
139   -- Session Labels:   MAC$S$<policy>, <session attribute>, <label>
140   g_context_session_label CONSTANT VARCHAR2(30) := g_context_prefix||'S$';
141   -- Factors:   MAC$FACTOR,<factor name>, <factor value>
142   g_context_factor CONSTANT VARCHAR2(30) := g_context_prefix||'FACTOR';
143   -- Realm:   MAC$REALM,<factor name>, <factor value>
144   g_context_realm CONSTANT VARCHAR2(30) := g_context_prefix||'REALM';
145 
146   -- This is that label that a factor will a null label will default to
147   g_min_policy_label CONSTANT VARCHAR2(30) := 'MIN_POLICY_LABEL';
148   -- This is the highest label a user could set based on the factors
149   -- (it does not take into account the user's label)
150   g_max_session_label CONSTANT VARCHAR2(30) := 'MAX_SESSION_LABEL';
151   -- The user's OLS session label at the time init_session is executed
152   g_ols_session_label CONSTANT VARCHAR2(30) := 'OLS_SESSION_LABEL';
153   -- This is what MACOLS decided the user's label should be set to
154   -- after factoring in the above values.
155   g_user_policy_label CONSTANT VARCHAR2(30) := 'USER_POLICY_LABEL';
156 
157   /**
158   * Returns an indicator as to whether or not OLS is installed
159   *
160   * @return TRUE if OLS is installed
161   */
162   FUNCTION is_ols_installed RETURN BOOLEAN;
163 
164   /**
165   * Returns an indicator as to whether or not OLS is installed
166   *
167   * @return Y if OLS is installed, N otherwise
168   */
169   FUNCTION is_ols_installed_varchar RETURN VARCHAR2;
170 
171   /**
172   * Returns an indicator as to whether or not DV is enabled
173   *
174   * @return TRUE if DV is enabled, FALSE otherwise
175   */
176   FUNCTION is_dv_enabled RETURN BOOLEAN ;
177 
178   -- check DATAPUMP DV authorization at full database level
179   FUNCTION check_full_dvauth RETURN BINARY_INTEGER;
180 
181   -- check DATAPUMP/TTS DV authorization for a specified tablespace
182   FUNCTION check_ts_dvauth(ts_name IN VARCHAR2) RETURN BINARY_INTEGER;
183 
184   -- check DATAPUMP/TTS DV authorization for a specified table
185   FUNCTION check_tab_dvauth(schema_name IN VARCHAR2,
186                             table_name  IN VARCHAR2) RETURN BINARY_INTEGER;
187 
188   /**
189   * Returns an indicator as to whether or not DV is enabled
190   *
191   * @return Y if DV is enabled, N otherwise
192   */
193   FUNCTION is_dv_enabled_varchar RETURN VARCHAR2 ;
194 
195   /**
196   * Returns an indicator as to whether or not OID enabled OLS is installed
197   *
198   * @return TRUE if OID enabled OLS is installed
199   */
200   FUNCTION is_oid_enabled_ols RETURN BOOLEAN;
201 
202   /**
203   * Returns ldap user if OID enabled OLS is installed
204   *
205   * @return logon user
206   */
207   FUNCTION ols_ldap_user RETURN VARCHAR2;
208 
209   /**
210   * Returns unique user ID whether user is from OID or standard database accounts
211   *
212   * @return unique user ID from OID or dbms_standard.login_user
213   */
214   FUNCTION unique_user RETURN VARCHAR2;
215 
216   /**
217   * Looks up the value for a code within a code group
218   *
219   * @param p_code_group Code group - e.g. AUDIT_EVENTS or BOOLEAN
220   * @return Value of the code
221   */
222   FUNCTION get_code_value(p_code_group VARCHAR2, p_code VARCHAR2) RETURN VARCHAR2;
223 
224   /**
225   * Looks up the id for a code within a code group
226   *
227   * @param p_code_group Code group - e.g. AUDIT_EVENTS or BOOLEAN
228   * @return Id of the code
229   */
230   FUNCTION get_code_id(p_code_group VARCHAR2, p_code VARCHAR2) RETURN NUMBER;
231 
232   /**
233   * Looks up an error message and replaces parameters accordingly
234   *
235   * @param p_message_code VARCHAR Message code
236   * @param p_parameter1 Value to substitute for %1
237   * @param p_parameter2 Value to substitute for %2
238   * @param p_parameter3 Value to substitute for %3
239   * @param p_parameter4 Value to substitute for %4
240   * @param p_parameter5 Value to substitute for %5
241   * @param p_parameter6 Value to substitute for %6
242   * @return Error message
243   */
244   FUNCTION get_message_label(p_message_code VARCHAR2,
245                         p_parameter1   IN VARCHAR2 DEFAULT NULL,
246                         p_parameter2   IN VARCHAR2 DEFAULT NULL,
247                         p_parameter3   IN VARCHAR2 DEFAULT NULL,
248                         p_parameter4   IN VARCHAR2 DEFAULT NULL,
249                         p_parameter5   IN VARCHAR2 DEFAULT NULL,
250                         p_parameter6   IN VARCHAR2 DEFAULT NULL) RETURN VARCHAR2;
251 
252   /**
253   * Looks up an error message and replaces parameters accordingly
254   *
255   * @param p_message_code NUMBER Message code
256   * @param p_parameter1 Value to substitute for %1
257   * @param p_parameter2 Value to substitute for %2
258   * @param p_parameter3 Value to substitute for %3
259   * @param p_parameter4 Value to substitute for %4
260   * @param p_parameter5 Value to substitute for %5
261   * @param p_parameter6 Value to substitute for %6
262   * @return Error message
263   */
264   FUNCTION get_message_label(p_message_code NUMBER,
265                         p_parameter1   IN VARCHAR2 DEFAULT NULL,
266                         p_parameter2   IN VARCHAR2 DEFAULT NULL,
267                         p_parameter3   IN VARCHAR2 DEFAULT NULL,
268                         p_parameter4   IN VARCHAR2 DEFAULT NULL,
269                         p_parameter5   IN VARCHAR2 DEFAULT NULL,
270                         p_parameter6   IN VARCHAR2 DEFAULT NULL) RETURN VARCHAR2;
271   /**
272   * Convience function to look up an error message and
273   * replaces parameters accordingly and raise an exception
274   *
275   * @param p_message_code Oracle error number
276   */
277   PROCEDURE raise_error(p_message_code IN NUMBER);
278   /**
279   * Convience function to look up an error message and
280   * replaces parameters accordingly and raise an exception
281   *
282   * @param p_message_code Oracle error number
283   * @param p_parameter1 Value to substitute for %1
284   */
285   PROCEDURE raise_error(p_message_code IN NUMBER,
286                         p_parameter1   IN VARCHAR2);
287   /**
288   * Convience function to look up an error message and
289   * replaces parameters accordingly and raise an exception
290   *
291   * @param p_message_code Oracle error number
292   * @param p_parameter1 Value to substitute for %1
293   * @param p_parameter2 Value to substitute for %2
294   */
295   PROCEDURE raise_error(p_message_code IN NUMBER,
296                         p_parameter1   IN VARCHAR2,
297                         p_parameter2   IN VARCHAR2);
298   /**
299   * Convience function to look up an error message and
300   * replaces parameters accordingly and raise an exception
301   *
302   * @param p_message_code Oracle error number
303   * @param p_parameter1 Value to substitute for %1
304   * @param p_parameter2 Value to substitute for %2
305   * @param p_parameter3 Value to substitute for %3
306   */
307   PROCEDURE raise_error(p_message_code IN NUMBER,
308                         p_parameter1   IN VARCHAR2,
309                         p_parameter2   IN VARCHAR2,
310                         p_parameter3   IN VARCHAR2);
311   /**
312   * Convience function to look up an error message and
313   * replaces parameters accordingly and raise an exception
314   *
315   * @param p_message_code Oracle error number
316   * @param p_parameter1 Value to substitute for %1
317   * @param p_parameter2 Value to substitute for %2
318   * @param p_parameter3 Value to substitute for %3
319   * @param p_parameter4 Value to substitute for %4
320   */
321   PROCEDURE raise_error(p_message_code IN NUMBER,
322                         p_parameter1   IN VARCHAR2,
323                         p_parameter2   IN VARCHAR2,
324                         p_parameter3   IN VARCHAR2,
325                         p_parameter4   IN VARCHAR2);
326 
327   /**
328   * Convience function to look up an error message and
329   * replaces parameters accordingly and raise an exception
330   *
331   * @param p_message_code Oracle error number
332   * @param p_parameter1 Value to substitute for %1
333   * @param p_parameter2 Value to substitute for %2
334   * @param p_parameter3 Value to substitute for %3
335   * @param p_parameter4 Value to substitute for %4
336   * @param p_parameter5 Value to substitute for %5
337   */
338   PROCEDURE raise_error(p_message_code IN NUMBER,
339                         p_parameter1   IN VARCHAR2,
340                         p_parameter2   IN VARCHAR2,
341                         p_parameter3   IN VARCHAR2,
342                         p_parameter4   IN VARCHAR2,
343                         p_parameter5   IN VARCHAR2);
344 
345   /**
346   * Convience function to look up an error message and
347   * replaces parameters accordingly and raise an exception
348   *
349   * @param p_message_code Oracle error number
350   * @param p_parameter1 Value to substitute for %1
351   * @param p_parameter2 Value to substitute for %2
352   * @param p_parameter3 Value to substitute for %3
353   * @param p_parameter4 Value to substitute for %4
354   * @param p_parameter5 Value to substitute for %5
355   * @param p_parameter6 Value to substitute for %6
356   */
360                         p_parameter3   IN VARCHAR2,
357   PROCEDURE raise_error(p_message_code IN NUMBER,
358                         p_parameter1   IN VARCHAR2,
359                         p_parameter2   IN VARCHAR2,
361                         p_parameter4   IN VARCHAR2,
362                         p_parameter5   IN VARCHAR2,
363                         p_parameter6   IN VARCHAR2);
364 
365 
366   /**
367   * Converts the audit_options value for a table to a VARCHAR2 form.
368   *
369   * @param p_table_name Name of a DV table with a audit_options column (e.g. realm$)
370   * @param p_audit_options Audit_options column value (can be several options 'OR-ed' together')
371   * @return Audit_options in VARCHAR2 form, separated by commas
372   */
373   FUNCTION decode_audit_options(p_table_name IN VARCHAR2,
374                                 p_audit_options IN NUMBER) RETURN VARCHAR2;
375 
376   /**
377   * Constructs an XML document which contains the values for all of the factors.  Note that
378   * the document is only intended for auditing or tracing and will be truncated if it is
379   * longer than 4000 characters.
380   *
381   * @return XML document containing the factor context
382   */
383   FUNCTION get_factor_context RETURN VARCHAR2;
384 
385   /**
386   * Concatenates the elements of an ora_name_list_t into a single VARCHAR2.
387   *
388   * @param p_sql_test Table of VARCHAR2 strings
389   * @return Single string
390   */
391   FUNCTION get_sql_text(p_sql_text IN ora_name_list_t) RETURN VARCHAR2;
392 
393   /**
394   * Checks whether the character is alphabetic.
395   *
396   * @param c String with one character
397   * @return TRUE if the character is alphabetic
398   */
399   FUNCTION is_alpha(c IN varchar2) RETURN BOOLEAN;
400 
401   /**
402   * Checks whether the character is numeric
403   *
404   * @param c String with one character
405   * @return TRUE if the character is a digit
406   */
407   FUNCTION is_digit(c IN varchar2) RETURN BOOLEAN;
408 
409   /**
410   * Alters a string to make it a legal Oracle identifier
411   *
412   * @param id Illegal identifier
413   * @return Identifier
414   */
415   FUNCTION to_oracle_identifier(id IN varchar2) RETURN VARCHAR2;
416 
417   /**
418   * Convenience procedure for generic disallowed operation exception
419   * throws ORA 20920 (Unauthorized Operation) error.
420   *
421   * @param p_user User performing the operation
422   */
423   PROCEDURE raise_unauthorized_operation(p_user IN VARCHAR2 DEFAULT USER);
424 
425   /**
426   * Determines whether a user is authorized to manage the DV configuration.  The
427   * DVSYS user and users directly granted the DV_OWNER role are authorized.
428   *
429   * @param p_user User to check
430   * @return TRUE if user is authorized
431   */
432   FUNCTION is_dvsys_owner(p_user IN VARCHAR2 DEFAULT USER) RETURN BOOLEAN;
433 
434   /**
435   * Verifies that a public-APIs are not being bypassed by users updating the DV
436   * configuration.
437   *
438   * @param p_user User performing the operation
439   * @throws ORA 20920 Unauthorized Operation
440   */
441   PROCEDURE check_dvsys_dml_allowed(p_user IN VARCHAR2 DEFAULT USER);
442 
443   /**
444   * Checks for a string in the PL/SQL call stack
445   *
446   * @param p_search_term String to search for
447   * @return TRUE if string is in the call stack
448   */
449   FUNCTION in_call_stack(p_search_term IN VARCHAR2) RETURN BOOLEAN;
450 
451   /**
452   * Checks whether a user has a role privilege, directly or indirectly (via another role).
453   *
454   * @param p_role Role privilege to check for
455   * @param p_user User
456   * @param p_profile Whether to capture the role usage; When the role checked
457   *        is used, please set p_profile to TRUE
458   * @return TRUE if use has the role
459   */
460   FUNCTION user_has_role(p_role IN VARCHAR2, p_user IN VARCHAR2 DEFAULT USER,
461                          p_profile IN BOOLEAN DEFAULT TRUE)
462     RETURN BOOLEAN;
463 
464   /**
465   * Checks whether the given role is enabled in the current session.
466   *
467   * @param p_role Role to check
468   * @return TRUE if the role is enabled in the current session
469   */
470   FUNCTION session_enabled_role(p_role    IN VARCHAR2)
471     RETURN BOOLEAN;
472 
473      /**
474   * Checks whether a user or role may access an object via a object privilege
475   * grant.  The object privilege may have been granted directly to the
476   * specified user/role or may have been granted indirectly via another role.
477   *
478   * @param p_user User or Role
479   * @param p_object_owner Object owner
480   * @param p_object_name Object name
481   * @param p_privilege Object privilege (SELECT, UPDATE, INSERT, ...)
482   * @param p_profile Whether to capture the object privilege; When the
483   *        privilege checked by this function is used, please set p_profile
484   *        to TRUE.
485   * @return TRUE if user/role has the privilege
486   */
487   FUNCTION user_has_object_privilege(p_user         IN VARCHAR2,
488                                      p_object_owner IN VARCHAR2,
489                                      p_object_name  IN VARCHAR2,
490                                      p_privilege    IN VARCHAR2,
491                                      p_profile      IN BOOLEAN DEFAULT TRUE)
495   * Checks whether a user has a role privilege, directly or indirectly (via another role).
492    RETURN BOOLEAN;
493 
494   /**
496   *
497   * @param p_role Role privilege to check for
498   * @param p_user User
499   * @param p_profile Whether to capture the role usage; When the role checked
500  *         is used, please set p_profile to TRUE.
501   * @return Y if use has the role, Y otherwise
502   */
503   FUNCTION user_has_role_varchar(p_role IN VARCHAR2,
504                                  p_user IN VARCHAR2 DEFAULT USER,
505                                  p_profile IN BOOLEAN DEFAULT TRUE)
506    RETURN VARCHAR2;
507 
508   /**
509   * Checks whether the given role is enabled in the current session.
510   *
511   * @param p_role Role to check
512   * @return Y if the role is enabled in the current session, N otherwise
513   */
514   FUNCTION session_enabled_role_varchar(p_role    IN VARCHAR2)
515     RETURN VARCHAR2;
516 
517   /**
518   * Checks whether a user has a system privilege, directly or indirectly (via a role).
519   *
520   * @param p_role System privilege to check for
521   * @param p_user User
522   * @param p_profile Whether to capture the system privilege; When the
523   *        privilege checked by this function is used, please set p_profile
524   *        to TRUE.
525   * @return TRUE if use has the privilege
526   */
527   FUNCTION user_has_system_privilege(p_privilege IN VARCHAR2,
528                                      p_user IN VARCHAR2 DEFAULT USER,
529                                      p_profile IN BOOLEAN DEFAULT TRUE)
530    RETURN BOOLEAN;
531 
532   /**
533   * Checks whether a user has a system privilege, directly or indirectly (via a role).
534   *
535   * @param p_role System privilege to check for
536   * @param p_user User
537   * @param p_profile Whether to capture the system privilege; When the
538   *        privilege checked by this function is used, please set p_profile
539   *        to TRUE.
540   * @return Y if use has the privilege; N otherwise
541   */
542   FUNCTION user_has_system_priv_varchar (p_privilege IN VARCHAR2,
543                                          p_user IN VARCHAR2 DEFAULT USER,
544                                          p_profile IN BOOLEAN DEFAULT TRUE)
545    RETURN VARCHAR2;
546 
547  /*
548   * Checks whether the given user can perform Streams administrative operation.
549   * This is determined by whether the user has DV_STREAMS_ADMIN role. Note that
550   * if DV is not enabled, then this function returns TRUE.
551   *
552   * @param p_user User
553   * @return TRUE if 1) DV is not enabled, or 2) the user has DV_STREAMS_ADMIN role.
554   *         FALSE otherwise.
555   */
556   FUNCTION check_streams_admin(p_user IN VARCHAR2) RETURN BOOLEAN;
557 
558  /*
559   * Checks whether the given user can perform Golden Gate extract operation.
560   * This is determined by whether the user has DV_GOLDENGATE_ADMIN role. Note
561   * that if DV is not enabled, then this function returns TRUE.
562   *
563   * @param p_user User
564   * @return TRUE if 1) DV is not enabled, or 2) user has DV_GOLDENGATE_ADMIN role.
565   *         FALSE otherwise.
566   */
567   FUNCTION check_goldengate_admin(p_user IN VARCHAR2) RETURN BOOLEAN;
568 
569  /*
570   * Checks whether the given user can perform XSTREAM capture operation.
571   * This is determined by whether the user has DV_XSTREAM_ADMIN role. Note
572   * that if DV is not enabled, then this function returns TRUE.
573   *
574   * @param p_user User
575   * @return TRUE if 1) DV is not enabled, or 2) user has DV_XSTREAM_ADMIN role.
576   *         FALSE otherwise.
577   */
578   FUNCTION check_xstream_admin(p_user IN VARCHAR2) RETURN BOOLEAN;
579 
580  /*
581   * Checks whether the given user can perform Golden Gate extract operation
582   * using the OCI interface. This is determined by whether the user has the
583   * DV_GOLDENGATE_REDO_ACCESS role. Note that if DV is not enabled, then this
584   * function always returns TRUE.
585   *
586   * @param p_user User
587   * @return TRUE if 1) DV is not enabled, or
588   *                 2) user has DV_GOLDENGATE_REDO_ACCESS role.
589   *         FALSE otherwise.
590   */
591   FUNCTION check_goldengate_redo_access(p_user IN VARCHAR2) RETURN BOOLEAN;
592 
593  /*
594   * Obtain the pipelined table of status of the events 10079 and 24473.
595   *
596   * @return pipelined table
597   */
598   FUNCTION get_event_status RETURN dvsys.event_status_table_type PIPELINED;
599 
600   /**
601   * Returns the month in Oracle MM format (01-12).
602   * @param p_date Date
603   * @return Month 01-12.
604   */
605   FUNCTION get_month(p_date IN DATE DEFAULT SYSDATE) RETURN NUMBER;
606 
607   /**
608   * Returns the day in Oracle DD format (01-31).
609   *
610   * @param p_date Date
611   * @return Day 01-31.
612   */
613   FUNCTION get_day(p_date IN DATE DEFAULT SYSDATE) RETURN NUMBER;
614 
615   /**
616   * Returns the year in Oracle YYYY format (0001-9999).
617   *
618   * @param p_date Date
619   * @return Year 0001-9999.
620   */
621   FUNCTION get_year(p_date IN DATE DEFAULT SYSDATE) RETURN NUMBER;
622 
623   /**
624   * Returns the month in Oracle HH24 format (00-23).
625   *
626   * @param p_date Date
627   * @return Hour 00-23.
628   */
629   FUNCTION get_hour(p_date IN DATE DEFAULT SYSDATE) RETURN NUMBER;
630 
631   /**
632   * Returns the minute in Oracle MI format (00-59).
633   *
634   * @param p_date Date
635   * @return Minute 00-59.
636   */
637   FUNCTION get_minute(p_date IN DATE DEFAULT SYSDATE) RETURN NUMBER;
638 
639   /**
640   * Returns the seconds in Oracle SS format (00-59).
641   *
642   * @param p_date Date
643   * @return Second 00-59.
644   */
645   FUNCTION get_second(p_date IN DATE DEFAULT SYSDATE) RETURN NUMBER;
646 
647 END;