ExternalAccessRolesController up
[portal.git] / portal-BE / src / main / java / org / onap / portal / domain / db / fn / FnRole.java
index 6bb13d7..ff03199 100644 (file)
@@ -55,6 +55,8 @@ import javax.persistence.Index;
 import javax.persistence.JoinColumn;
 import javax.persistence.JoinTable;
 import javax.persistence.ManyToMany;
+import javax.persistence.NamedNativeQueries;
+import javax.persistence.NamedNativeQuery;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.OneToMany;
@@ -113,6 +115,9 @@ CREATE TABLE `fn_role` (
     @NamedQuery(
         name = "FnRole.retrieveActiveRolesOfApplication",
         query = "from FnRole where activeYn = 'Y' and appId=:appId"),
+    @NamedQuery(
+        name = "FnRole.retrieveActiveRolesWhereAppIdIsNull",
+        query = "from FnRole where activeYn = 'Y' and appId is null"),
     @NamedQuery(
         name = "FnRole.getUserRoleOnUserIdAndAppId",
         query = " FROM"
@@ -137,6 +142,13 @@ CREATE TABLE `fn_role` (
     )
 })
 
+@NamedNativeQuery(
+    name = "FnRole.userAppGlobalRoles",
+    query = "select fr.role_id , fr.role_name ,fr.active_yn, fr.priority, fr.app_id, fr.app_role_id \n"
+        + " from fn_user_role a, fn_role fr, fn_user fu \n"
+        + " where a.role_id in (select b.role_id from ep_app_role_function b where b.role_app_id = 1 and b.app_id =:appId) and a.user_id =fu.user_id and a.role_id = fr.role_id and fr.active_yn='Y' and fu.active_yn='Y' and fu.user_id =:userId\n"
+)
+
 @Table(name = "fn_role")
 @NoArgsConstructor
 @Getter