+ ]]>
+ </sql-query>
+
+ <sql-query name="getAllCentralizedAppsRoles">
+ <return alias="allCentralizedAppsRoles"
+ class="org.onap.portalapp.portal.transport.CentralizedAppRoles" />
+ <![CDATA[
+ select distinct fa.app_id, fa.auth_namespace, fr.role_name, fr.role_id from fn_app fa, fn_role fr where fa.auth_central = 'Y' and fa.auth_namespace is not null
+ and (fa.app_id = fr.app_id or COALESCE(fr.app_id,1) = fa.app_id) and fr.active_yn = 'Y' order by fa.app_id ;
+ ]]>
+ </sql-query>
+
+ <sql-query name="getUserCentralizedAppRoles">
+ <return alias="userCentralizedAppRoles"
+ class="org.onap.portalapp.portal.transport.CentralizedAppRoles" />
+ <![CDATA[
+ select distinct fur.app_id, fa.auth_namespace, fr.role_name, fur.role_id from fn_user_role fur, fn_app fa, fn_role fr, fn_user fu
+ where fa.app_id = fur.app_id
+ and fr.role_id = fur.role_id
+ and fu.user_id = fur.user_id
+ and fu.ORG_USER_ID = :orgUserId
+ and fa.auth_namespace is not null
+ and fr.active_yn = 'Y'
+ order by role_id;
+ ]]>
+ </sql-query>
+ <sql-query name="getAprroverRoleFunctionsOfUser">
+ <![CDATA[
+ select distinct ep.function_cd from fn_user_role fu, ep_app_role_function ep, ep_app_function ea
+ where fu.role_id = ep.role_id
+ and fu.app_id = ep.app_id
+ and fu.user_id =:userId
+ and ea.function_cd = ep.function_cd and ea.function_cd like 'approver|%'
+ and exists
+ (
+ select fa.app_id from fn_user fu, fn_user_role ur, fn_app fa where fu.user_id =:userId and fu.user_id = ur.user_id
+ and ur.app_id = fa.app_id and fa.enabled = 'Y'
+ );
+ ]]>
+</sql-query>
+<sql-query name="getUserApproverRoles">
+ <![CDATA[
+ select distinct fr.role_name from fn_user_role fu, ep_app_role_function ep, ep_app_function ea, fn_role fr
+ where fu.role_id = ep.role_id
+ and fu.app_id = ep.app_id
+ and fu.user_id = :userId
+ and fu.role_id = fr.role_id and fr.active_yn='Y'
+ and ea.function_cd = ep.function_cd and ea.function_cd like 'approver|%'
+ and exists
+ (
+ select fa.app_id from fn_user fu, fn_user_role ur, fn_app fa where fu.user_id =:userId and fu.user_id = ur.user_id
+ and ur.app_id = fa.app_id and fa.enabled = 'Y'
+ );
+ ]]>
+</sql-query>
+<sql-query name="getAdminAppsForTheUser">
+ <![CDATA[
+ select fa.app_id from fn_user_role ur,fn_app fa where ur.user_id =:userId and ur.app_id=fa.app_id and ur.role_id= 999 and (fa.enabled = 'Y' || fa.app_id=1)
+
+
+ ]]>
+</sql-query>
+
+
+<sql-query name="getUserRoleOnUserIdAndAppId">
+ <return alias="getUserRoleOnUserIdAndAppId" class="org.onap.portalapp.portal.domain.EPRole" />
+ <![CDATA[
+
+ select fr.role_id , fr.role_name ,fr.active_yn, fr.priority, fr.app_id, fr.app_role_id FROM fn_role fr, fn_user_role fur WHERE fr.role_id = fur.role_id AND fur.user_id= :userId AND fur.app_id = :appId AND fr.active_yn='Y'
+
+ ]]>
+ </sql-query>
+
+ <sql-query name="getAllAdminAppsofTheUser">
+ <![CDATA[
+ select fa.app_id from fn_user_role ur,fn_app fa where ur.user_id =:userId and ur.app_id=fa.app_id and ur.role_id= 999
+
+ ]]>
+ </sql-query>
+ <sql-query name="getAllAppsFunctionsOfUser">
+ <![CDATA[
+ select distinct ep.function_cd from fn_user_role fu, ep_app_role_function ep, ep_app_function ea, fn_app fa , fn_role fr
+ where fu.role_id = ep.role_id
+ and fu.app_id = ep.app_id
+ and fu.user_id =:userId
+ and ea.function_cd = ep.function_cd
+ and ((fu.app_id = fa.app_id and fa.enabled = 'Y' ) or (fa.app_id = 1))
+ and fr.role_id = fu.role_id and fr.active_yn='Y'
+ union
+ select distinct app_r_f.function_cd from ep_app_role_function app_r_f, ep_app_function a_f
+ where role_id = 999
+ and app_r_f.function_cd = a_f.function_cd
+ and exists
+ (
+ select fa.app_id from fn_user fu, fn_user_role ur, fn_app fa where fu.user_id =:userId and fu.user_id = ur.user_id
+ and ur.role_id = 999 and ur.app_id = fa.app_id and fa.enabled = 'Y'
+ );
+ ]]>
+ </sql-query>
+ <sql-query name="updateFnUser">
+ <![CDATA[
+ UPDATE fn_user fu SET fu.language_id=:language_id WHERE fu.login_id=:login_id
+ ]]>
+ </sql-query>