From 25fd6ec5c37a158ae8ce9ec96ed396c047a9bb17 Mon Sep 17 00:00:00 2001 From: mullenm Date: Wed, 16 Jan 2008 14:31:11 +0000 Subject: [PATCH] added check that the returned role is NOT null if it is return FALSE. This was because it wasn't giving a no data found error as expected. git-svn-id: http://locode01.ad.dom/svn/WEBMIP/trunk@3259 248e525c-4dfb-0310-94bc-949c084e9493 --- Modules/mip_parties.pck | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Modules/mip_parties.pck b/Modules/mip_parties.pck index 84e2032..c97549f 100644 --- a/Modules/mip_parties.pck +++ b/Modules/mip_parties.pck @@ -1,6 +1,6 @@ CREATE OR REPLACE PACKAGE mip_parties AS - FUNCTION is_tripartite(p_mktp_ref IN VARCHAR2) RETURN BOOLEAN; + FUNCTION is_tripartite(p_user_id IN VARCHAR2) RETURN BOOLEAN; FUNCTION get_user_id(p_username IN VARCHAR2) RETURN NUMBER; FUNCTION get_user_role(p_username IN VARCHAR2) RETURN VARCHAR2; -- @@ -192,10 +192,10 @@ CREATE OR REPLACE PACKAGE BODY mip_parties AS - mktp_ref and returns true if the tripartite member column is yes. %param p_mktp_ref - the market participant (supplier) to check. */ - FUNCTION is_tripartite(p_mktp_ref IN VARCHAR2) RETURN BOOLEAN AS + FUNCTION is_tripartite(p_user_id IN VARCHAR2) RETURN BOOLEAN AS l_tripartite_status varchar2(3); CURSOR c_tripartite IS - SELECT distinct tripartite_member FROM parties WHERE upper(mktp_ref) = upper(p_mktp_ref); + SELECT distinct tripartite_member FROM parties WHERE id = p_user_id; BEGIN OPEN c_tripartite; FETCH c_tripartite @@ -262,6 +262,10 @@ CREATE OR REPLACE PACKAGE BODY mip_parties AS - if found then true is returned. %param p_username - the name of the user you want to get the id for. %param p_role - the role you wish to check against + + update - 16-Jan-2008 - MM - added check that the returned role is NOT null + if it is return FALSE. This was because it wasn't + giving a no data found error as expected. */ FUNCTION check_user_role(p_username IN VARCHAR2, p_role IN VARCHAR2) RETURN BOOLEAN AS rolecode VARCHAR2(80); @@ -275,14 +279,18 @@ CREATE OR REPLACE PACKAGE BODY mip_parties AS FETCH c_userrole INTO rolecode; CLOSE c_userrole; - - RETURN TRUE; + + IF rolecode IS NOT NULL THEN + RETURN TRUE; + ELSE RETURN FALSE; + END IF; EXCEPTION WHEN OTHERS THEN - RETURN NULL; + CLOSE c_userrole; + RETURN FALSE; END check_user_role; -- - -- + /** get the password created date for the given username and password %return DATE the date the password was created for authenticated username and password combination