From 7c2f7e70bcc5ef68b891eef4877d6197abab12f1 Mon Sep 17 00:00:00 2001 From: Balaji <104271023+tbalaji0001@users.noreply.github.com> Date: Mon, 18 Mar 2024 09:57:33 +0530 Subject: [PATCH] URL Changed Based on Domain and nginx For domain access, we utilize Nginx, which functions as both a web server and a reverse proxy. It directs base URL requests to the localhost server URL and facilitates access to files outside the web server based on the specified path (such as for uploading files). --- .../configuration/JacksonConfiguration.java | 5 +- .../configuration/SecurityConfig.java | 16 +- .../gccoffice/controller/APIController.java | 56 ++++++ .../gccoffice/controller/FileController.java | 73 ++++++++ .../gccoffice/controller/MainController.java | 7 +- .../gccoffice/interceptor/AppInterceptor.java | 35 ++-- .../controller/APIController.java | 2 +- .../controller/MainController.java | 2 +- .../pgr/controller/MainController.java | 1 + .../gccoffice/pgr/service/PGRCommon.java | 1 + .../repository/AppUserRepository.java | 2 +- .../gccoffice/service/Base64Util.java | 38 ++++ .../service/CustomUserDetailsService.java | 3 +- .../gccoffice/service/LoginUserInfo.java | 2 + src/main/resources/.DS_Store | Bin 6148 -> 8196 bytes src/main/resources/application.properties | 18 +- src/main/resources/static/.DS_Store | Bin 8196 -> 8196 bytes src/main/resources/static/assets/.DS_Store | Bin 12292 -> 12292 bytes .../resources/static/assets/dist/.DS_Store | Bin 6148 -> 6148 bytes .../static/assets/dist/css/theme.css | 4 +- .../resources/static/assets/images/.DS_Store | Bin 6148 -> 8196 bytes src/main/resources/templates/.DS_Store | Bin 6148 -> 6148 bytes .../fragments/modules/base/footer.html | 2 +- .../fragments/modules/base/header.html | 30 +--- .../fragments/modules/base/menu.html | 2 +- src/main/resources/templates/index.html | 163 ++++++++++++++++-- .../modules/admin/user-group-access.html | 2 +- .../templates/modules/admin/user-list.html | 2 +- .../templates/modules/mtm/index.html | 6 +- .../templates/modules/mtm/officer/index.html | 6 +- .../petregistration/accepted-list.html | 16 +- .../modules/petregistration/index.html | 2 +- .../petregistration/license-issued.html | 14 +- .../modules/petregistration/rejected.html | 18 +- .../modules/petregistration/request-list.html | 18 +- .../templates/modules/pgr/all-list.html | 12 +- .../templates/modules/pgr/index.html | 56 +++--- .../templates/modules/qrfeedback/index.html | 18 +- 38 files changed, 480 insertions(+), 152 deletions(-) create mode 100644 src/main/java/in/gov/chennaicorporation/gccoffice/controller/FileController.java create mode 100644 src/main/java/in/gov/chennaicorporation/gccoffice/service/Base64Util.java diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/JacksonConfiguration.java b/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/JacksonConfiguration.java index 503271f..291a83b 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/JacksonConfiguration.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/JacksonConfiguration.java @@ -4,6 +4,7 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; @Configuration public class JacksonConfiguration { @@ -11,7 +12,9 @@ public class JacksonConfiguration { @Bean public ObjectMapper objectMapper() { ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); // Do not fail on empty beans during serialization + objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); // Serialize dates as Strings + objectMapper.registerModule(new JavaTimeModule()); // Register JavaTimeModule for Java 8 Date/Time support return objectMapper; } } \ No newline at end of file diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/SecurityConfig.java b/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/SecurityConfig.java index f649920..91fe7a7 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/SecurityConfig.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/configuration/SecurityConfig.java @@ -31,7 +31,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { public void configure(WebSecurity web) throws Exception { web .ignoring() - .antMatchers("/static/**", "/assets/**", "/api/**","/images/**","/gcc/static/**", "/gcc/assets/**", "/gcc/api/**","/gcc/images/**"); + .antMatchers("/static/**", "/assets/**", "/api/**","/images/**","/gcc/static/**", "/gcc/assets/**", "/gcc/api/**","/gcc/images/**","/gcc/files/**"); //.antMatchers("/gcc/static/**", "/gcc/assets/**", "/gcc/api/**","/gcc/images/**"); //.antMatchers("/assets/**", "/css/**", "/js/**", "/images/**", "/fonts/**"); // Add the paths to your static resources here } @@ -52,7 +52,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { .antMatchers("/gcc/error").permitAll() .antMatchers("/gcc/login").permitAll() // Add the login URL .antMatchers("/gcc/admin/**").hasRole("ADMIN") // Add the admin URLs - .antMatchers("/gcc/**").hasAnyRole("USER", "ADMIN") // Add other URLs + .antMatchers("/gcc/**").hasAnyRole("ADMIN","USER") // Add other URLs + //.anyRequest().authenticated() .and() .formLogin() .loginPage("/gcc/login") // Customize the login page URL @@ -62,10 +63,21 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { .logout() .logoutUrl("/gcc/logout") // Include the logout URL .logoutSuccessUrl("/gcc/login") // Include the success logout URL + .permitAll() .and() .sessionManagement() .sessionFixation() .migrateSession(); // or .none(), .newSession() + + /* + // Print role values + http.authorizeRequests().anyRequest().authenticated().and().formLogin().successHandler((request, response, authentication) -> { + System.out.println("User Roles: "); + authentication.getAuthorities().forEach(authority -> System.out.println(authority.getAuthority())); + System.out.println(); + response.sendRedirect("/gcc"); + }); + */ } diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/controller/APIController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/controller/APIController.java index 7508d0c..7dc8179 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/controller/APIController.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/controller/APIController.java @@ -1,5 +1,6 @@ package in.gov.chennaicorporation.gccoffice.controller; +import java.util.Base64; import java.util.List; import java.util.Map; import java.time.LocalDateTime; @@ -88,6 +89,22 @@ public class APIController { } + // Encode to Base64 + @GetMapping(value="/encodeBase64") + public static String encodeBase64(@RequestParam String string) { + String value=string; + byte[] encodedBytes = Base64.getEncoder().encode(value.getBytes()); + return new String(encodedBytes); + } + + // Decode from Base64 + @GetMapping(value="/decodeBase64") + public static String decodeBase64(@RequestParam String string) { + String encodedValue=string; + byte[] decodedBytes = Base64.getDecoder().decode(encodedValue); + return new String(decodedBytes); + } + @GetMapping(value="/getAccessTree") public String getAccessTreeHTML(@RequestParam String groupId,@RequestParam String groupName) { @@ -228,6 +245,43 @@ public class APIController { return ""; } + @GetMapping(value="/getUserProfileBasic") + public String getUserProfileBasic(@RequestParam String userId) { + String userHtml =""; + String userProfileHtml =""; + String userProfileTimelineHtml =""; + getAppUserEntities = appUserRepository.showById(userId); + for (AppUserEntity appUserEntity : getAppUserEntities) { + + userProfileHtml = "" + + " " + + "
" + + "
" + + "
" + + " \n" + + "

"+appUserEntity.getUserid().getName()+"

\n" + + "

Front End Developer

\n" + + "
\n" + + "
" + + "
\n" + + "
\n" + + " Email address \n" + + " "+appUserEntity.getUserid().getEmail()+" \n" + + " Phone\n" + + " "+appUserEntity.getUserid().getPhone()+" \n" + + " Role\n" + + " "+appUserEntity.getRoles()+"\n" + + " Access Group\n" + + " "+appUserEntity.getUsergroup_id().getName()+"\n" + + "
\n" + + "
\n" + + " "; + + } + + return userProfileHtml; + } + @GetMapping(value="/getUserProfile") public String getUserProfile(@RequestParam String userId) { String userHtml =""; @@ -334,4 +388,6 @@ public class APIController { //System.out.println(formattedTimestamp); return formattedTimestamp.toUpperCase(); } + + } diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/controller/FileController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/controller/FileController.java new file mode 100644 index 0000000..795c693 --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/controller/FileController.java @@ -0,0 +1,73 @@ +package in.gov.chennaicorporation.gccoffice.controller; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.Resource; +import org.springframework.core.io.UrlResource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.servlet.HandlerMapping; + +import java.nio.file.Path; +import java.nio.file.Paths; + +import javax.servlet.http.HttpServletRequest; + +@Controller +public class FileController { + + @Value("${file.upload.directory}") + private String uploadDirectory; + + @GetMapping("/gcc/files/{directoryPath}/**") + public ResponseEntity serveFile(@PathVariable String directoryPath, HttpServletRequest request) { + String fullPath = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE); + System.out.println(fullPath.toString()+"\n"+directoryPath.length()+"\n directoryPath:"+directoryPath); + //String relativePath = fullPath.substring(directoryPath.length() + 1); // Adding 1 for the trailing '/' + String relativePath = fullPath.replace("/gcc/files", ""); + String filePath = uploadDirectory + "/" + relativePath; + Path path = Paths.get(filePath).normalize(); + System.out.println(path.toString()); + Resource resource; + try { + resource = new UrlResource(path.toUri()); + if (resource.exists() || resource.isReadable()) { + MediaType mediaType = MediaType.APPLICATION_OCTET_STREAM; + // Determine content type based on file extension + String fileName = resource.getFilename(); + if (fileName != null) { + String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1); + switch (fileExtension.toLowerCase()) { + case "jpg": + case "jpeg": + mediaType = MediaType.IMAGE_JPEG; + break; + case "png": + mediaType = MediaType.IMAGE_PNG; + break; + case "gif": + mediaType = MediaType.IMAGE_GIF; + break; + case "pdf": + mediaType = MediaType.APPLICATION_PDF; + break; + // Add more cases for other file types if needed + } + } + return ResponseEntity.ok() + .contentType(mediaType) + .header(HttpHeaders.CONTENT_DISPOSITION, "inline; filename=\"" + resource.getFilename() + "\"") + //.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + resource.getFilename() + "\"") + .body(resource); + } else { + return ResponseEntity.notFound().build(); + } + } catch (Exception e) { + return ResponseEntity.notFound().build(); + } + } +} + diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/controller/MainController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/controller/MainController.java index b707a06..4cc55b8 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/controller/MainController.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/controller/MainController.java @@ -20,10 +20,11 @@ public class MainController { @GetMapping({"", "/", "/index"}) public String main(Model model) { - String userId = LoginUserInfo.getLoginUserId(); - if (userId != null && !userId.isEmpty()) { - System.out.println("String UserID: " + userId); + String LoginUserId = LoginUserInfo.getLoginUserId(); + if (LoginUserId != null && !LoginUserId.isEmpty()) { + System.out.println("String UserID: " + LoginUserId); } + model.addAttribute("LoginUserId",LoginUserId); return "index"; } diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/interceptor/AppInterceptor.java b/src/main/java/in/gov/chennaicorporation/gccoffice/interceptor/AppInterceptor.java index 173e34e..55d3928 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/interceptor/AppInterceptor.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/interceptor/AppInterceptor.java @@ -100,7 +100,7 @@ public class AppInterceptor implements HandlerInterceptor { private boolean hasModuleAccess(String moduleName) { getAppModuleEntities = appModuleRepository.findByModulePath(moduleName); - System.out.println("DataTable Size for the url ("+moduleName+"): "+getAppModuleEntities.size()); + //System.out.println("DataTable Size for the url ("+moduleName+"): "+getAppModuleEntities.size()); String moduleid = null; @@ -112,6 +112,7 @@ public class AppInterceptor implements HandlerInterceptor { String userGroupId = LoginUserInfo.getUserGroupId(); System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid); getAppModuleAccessEntities = appModuleAccessRepository.findByAll(userGroupId,moduleid); + //System.out.println("After Check in(hasModuleAccess):"+getAppModuleAccessEntities.size()); if(getAppModuleAccessEntities.size()>0) { return true; } @@ -125,7 +126,7 @@ public class AppInterceptor implements HandlerInterceptor { if(!hasModuleAccess(moduleName)) {return false; } getMenuItemEntities = menuItemRepository.findByUrl(url); - System.out.println("DataTable Size for the url ("+url+"): "+getMenuItemEntities.size()); + //System.out.println("DataTable Size for the url ("+url+"): "+getMenuItemEntities.size()); String moduleid = null; String menuid = null; @@ -137,7 +138,7 @@ public class AppInterceptor implements HandlerInterceptor { } if(moduleid != null && menuid != null) { String userGroupId = LoginUserInfo.getUserGroupId(); - System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid+"\n menuid : "+menuid); + //System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid+"\n menuid : "+menuid); getMenuItemAccessEntities = menuItemAccessRepository.findByAll(userGroupId,moduleid,menuid); if(getMenuItemAccessEntities.size()>0) { return true; @@ -152,7 +153,7 @@ public class AppInterceptor implements HandlerInterceptor { if(!hasModuleAccess(moduleName)) {return false; } getSubMenuItemEntities = subMenuItemRepository.findByUrl(url); - System.out.println("DataTable Size for the url ("+url+"): "+getSubMenuItemEntities.size()); + //System.out.println("DataTable Size for the url ("+url+"): "+getSubMenuItemEntities.size()); String moduleid = null; String menuid = null; @@ -166,12 +167,12 @@ public class AppInterceptor implements HandlerInterceptor { } if(moduleid != null && menuid != null && submenuid != null) { String userGroupId = LoginUserInfo.getUserGroupId(); - System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid+"\n menuid : "+menuid+"\n submenuid : "+submenuid); + //System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid+"\n menuid : "+menuid+"\n submenuid : "+submenuid); getSubMenuItemAccessEntities = subMenuItemAccessRepository.findByAll(userGroupId,moduleid,menuid,submenuid); if(getSubMenuItemAccessEntities.size()>0) { // Check Parent Menu Access (Menu Access) if(moduleid != null && menuid != null) { - System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid+"\n menuid : "+menuid); + //System.out.println("Query input`s :\n userGroupId : "+userGroupId+"\n moduleid : "+moduleid+"\n menuid : "+menuid); getMenuItemAccessEntities = menuItemAccessRepository.findByAll(userGroupId,moduleid,menuid); if(getMenuItemAccessEntities.size()>0) { return true; @@ -186,9 +187,11 @@ public class AppInterceptor implements HandlerInterceptor { private boolean hasAccess(String path) { String userRole = LoginUserInfo.getUserRole(); + if (userRole != null && userRole.equals("ADMIN")) { return true; } + /* if(LoginUserInfo.getUserRole().equals("ADMIN")) { return true; @@ -196,7 +199,9 @@ public class AppInterceptor implements HandlerInterceptor { */ String url = removeLeadingSlash(path); - System.out.println("Give URL : "+path+" After remove leading slash : "+url); + url = removeStartingString(url); // Remove parent App url "gcc" + + //System.out.println("Give URL : "+path+" After remove leading slash : "+url); // If default home page if(path.equals("/")) { @@ -208,7 +213,7 @@ public class AppInterceptor implements HandlerInterceptor { if(parts.length<=0) {return true;} - System.out.println(parts.length); + //System.out.println("Part Length:"+ parts.length); if(parts.length>1) { int j=0; @@ -219,8 +224,9 @@ public class AppInterceptor implements HandlerInterceptor { String moduleName = ""; String menuName = ""; String subMenuName = ""; - if(parts.length==2) { // Check Only Module Access - moduleName = parts[1]; + + if(parts.length==1) { // Check Only Module Access + moduleName = parts[0]; return hasModuleAccess(moduleName); } else if(parts.length==2) { // Check Module & Menu Access @@ -237,7 +243,7 @@ public class AppInterceptor implements HandlerInterceptor { } } - return false; + return true; } public static String removeLeadingSlash(String input) { @@ -247,6 +253,13 @@ public class AppInterceptor implements HandlerInterceptor { return input; } + public static String removeStartingString(String input) { + if (input.startsWith("gcc")) { + return removeLeadingSlash(input.substring(3)); + } + return input; + } + @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String assetsBaseUrl = environment.getProperty("assets.base-url"); diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/APIController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/APIController.java index f1ad25d..205f4c6 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/APIController.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/APIController.java @@ -18,7 +18,7 @@ import org.springframework.web.util.UriComponentsBuilder; import in.gov.chennaicorporation.gccoffice.configuration.AppConfig; -@RequestMapping("/api/petregistration") +@RequestMapping("/gcc/api/petregistration") @RestController("petRegistrationRest") public class APIController { private final RestTemplate restTemplate; diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/MainController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/MainController.java index 6283774..977df87 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/MainController.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/petregistration/controller/MainController.java @@ -20,7 +20,7 @@ import in.gov.chennaicorporation.gccoffice.petregistration.data.PetCountInfo; import in.gov.chennaicorporation.gccoffice.petregistration.data.RequestList; import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; -@RequestMapping("/petregistration") +@RequestMapping("/gcc/petregistration") @Controller("petregistration") public class MainController { private final RestTemplate restTemplate; diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/pgr/controller/MainController.java b/src/main/java/in/gov/chennaicorporation/gccoffice/pgr/controller/MainController.java index c01e4dd..e4417b0 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/pgr/controller/MainController.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/pgr/controller/MainController.java @@ -9,6 +9,7 @@ import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.client.RestTemplate; import in.gov.chennaicorporation.gccoffice.pgr.service.PGRCommon; import in.gov.chennaicorporation.gccoffice.service.LoginUserInfo; diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/pgr/service/PGRCommon.java b/src/main/java/in/gov/chennaicorporation/gccoffice/pgr/service/PGRCommon.java index eee4e45..551168a 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/pgr/service/PGRCommon.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/pgr/service/PGRCommon.java @@ -170,6 +170,7 @@ public class PGRCommon { + " cs.statusname AS status, " + " usr.user_name, " + " cd.complaintnumber, " + + " cd.ID_MODE AS \"MODE\", " + " COALESCE(ct.complainttypename, 'Unspecified') AS complainttypename, " + " cg.complaintgroupname " + "FROM eggr_complaintdetails@erp cd " diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/repository/AppUserRepository.java b/src/main/java/in/gov/chennaicorporation/gccoffice/repository/AppUserRepository.java index 06ce20c..9a54490 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/repository/AppUserRepository.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/repository/AppUserRepository.java @@ -20,7 +20,7 @@ public interface AppUserRepository extends JpaRepository @Query(value = "SELECT * FROM `appusers`", nativeQuery = true) List showAll(); - @Query(value = "SELECT * FROM `appusers` WHERE (id=:userId AND `isdelete`=0)", nativeQuery = true) + @Query(value = "SELECT * FROM `appusers` WHERE (userid=:userId AND `isdelete`=0)", nativeQuery = true) List showById(String userId); AppUserEntity findByUsername(String username); diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/service/Base64Util.java b/src/main/java/in/gov/chennaicorporation/gccoffice/service/Base64Util.java new file mode 100644 index 0000000..e5030a7 --- /dev/null +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/service/Base64Util.java @@ -0,0 +1,38 @@ +package in.gov.chennaicorporation.gccoffice.service; + +import java.util.Base64; +import java.util.List; + +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class Base64Util { + + // Encode to Base64 + public static String encodeBase64(String value) { + if (value != null && !value.isEmpty()) { + byte[] encodedBytes = Base64.getEncoder().encode(value.getBytes()); + return new String(encodedBytes); + } + else { + return ""; + } + } + + // Decode from Base64 + public static String decodeBase64(String encodedValue) { + if (encodedValue != null && !encodedValue.isEmpty()) { + try { + byte[] decodedBytes = Base64.getDecoder().decode(encodedValue); + return new String(decodedBytes); + } catch (IllegalArgumentException e) { + // Handle the exception, e.g., log it or return an error message + System.err.println("Error decoding Base64 string: " + e.getMessage()); + return "error"; // Or return an error message string + } + } else { + return ""; + } + } +} diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/service/CustomUserDetailsService.java b/src/main/java/in/gov/chennaicorporation/gccoffice/service/CustomUserDetailsService.java index b5a3819..da468ee 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/service/CustomUserDetailsService.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/service/CustomUserDetailsService.java @@ -30,7 +30,7 @@ public class CustomUserDetailsService implements UserDetailsService { @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { AppUserEntity appUserEntity = appUserRepository.findByUsername(username); - + userActivityService.logUserActivity("0", "Trying to Login with Username: " + username); //System.out.println(username); if (appUserEntity == null) { @@ -53,6 +53,7 @@ public class CustomUserDetailsService implements UserDetailsService { userRole = "ROLE_" + userRole; //System.out.println("User Role: "+userRole); } + // Create a SimpleGrantedAuthority for the user role SimpleGrantedAuthority authority = new SimpleGrantedAuthority(userRole); diff --git a/src/main/java/in/gov/chennaicorporation/gccoffice/service/LoginUserInfo.java b/src/main/java/in/gov/chennaicorporation/gccoffice/service/LoginUserInfo.java index 87c4bbc..77dcf5d 100644 --- a/src/main/java/in/gov/chennaicorporation/gccoffice/service/LoginUserInfo.java +++ b/src/main/java/in/gov/chennaicorporation/gccoffice/service/LoginUserInfo.java @@ -23,7 +23,9 @@ public class LoginUserInfo { public static String getLoginUserId() { UserDetails userDetails = LoginUserInfo.getCurrentUserDetails(); + if (userDetails instanceof CustomUserDetails) { + //System.out.println("User Details : "+userDetails.toString()); CustomUserDetails customUserDetails = (CustomUserDetails) userDetails; Map additionalAttributes = customUserDetails.getAdditionalAttributes(); if (additionalAttributes != null) { diff --git a/src/main/resources/.DS_Store b/src/main/resources/.DS_Store index e2e5a629bdca4b8d3d03cf27656b1f7f5cb08fef..d6f2016f62c207bfe4d2b8114a7ff7cd6f52fe95 100644 GIT binary patch delta 234 zcmZoMXmOBWU|?W$DortDU;r^WfEYvza8E20o2aMA$iFdQH}hr%jz7$c**Q2SHn6br z1Epmq3$TcD>oVjpHP--Ad7)P5u}V)m!W{62&gcHp_Czc zvK)&JAJbK2g`0U;1Q{9GC(E%$^Ko#-3rJK~8(Es^C|HGYp&KdFC(!0PBD>c>n+a delta 165 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{Mvv5r;6q~50$jG}fU^g=>FHlHqvVeg2ki85{5I2CF#jrV^XAUy}W_uq+ diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index eb978c2..899e0f3 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -40,14 +40,28 @@ server.servlet.session.tracking-modes=COOKIE #logging.level.root=DEBUG -file.upload.directory=${user.dir}/gccoffice_uploads +file.upload.directory=${user.dir}/gccoffice_uploads/ server.address=0.0.0.0 server.servlet.session.timeout=-1 server.servlet.session.cookie.name= GCCONEPORTALSESSION -server.servlet.session.cookie.max-age= -1 +server.servlet.session.cookie.max-age=-1 +server.servlet.session.cookie.http-only=true +server.servlet.session.cookie.secure=true #server.servlet.session.timeout:5m #server.servlet.session.cookie.name: MYSESSIONID #server.servlet.session.cookie.max-age: 10m + +#///////// For Mayor Petition ////////// +mp_ackno_prefix=MP +mp_ackno = 10000000 +mp_foldername = m_petition +mp_action_Foldername = m_action_file + +#///////// For Councillor Petition ////////// +cp_ackno_prefix=CP +cp_ackno = 10000000 +cp_foldername = c_petition +cp_action_Foldername = c_action_file diff --git a/src/main/resources/static/.DS_Store b/src/main/resources/static/.DS_Store index 7976c9553cea783b830e0cc9b3866c48c460cd00..90abfd6164dc0c8e0fa4b50aca23e36035305545 100644 GIT binary patch delta 33 ocmZp1XmQw(D!|A-IZYs%kApK_K%%z;?0G)UUz;?0G&+;-T(jq diff --git a/src/main/resources/static/assets/.DS_Store b/src/main/resources/static/assets/.DS_Store index f7c17a6f5ec4f3c6d04961e0172491ec7f81c809..6389ea291dec416cd8ddba9c4efa14330c0fd62c 100644 GIT binary patch delta 393 zcmZokXi3;$B|f=VNoaDcLIRgWb+wVDnT~>m$z)Dtr_JBQg*hg3D>yLjnCzoah$`!_ znN4vfBbu(woXQf6*iCbod|Raeht$N$l9T1sOqnEQCWorsk&YMOFV4s>_e{>u3n)r0 z%S1PZ79C&!0S*x`g&-I?L-O+TQaP0!0w98u=c+3*N>1LdF3y-W e`MSCSM zGMQV!fpPofex*Ww@#<9d!j>kmne37*ZLE%YutG PvuONenWXAB*xUsGC_8s7 diff --git a/src/main/resources/static/assets/dist/.DS_Store b/src/main/resources/static/assets/dist/.DS_Store index 1c0eefa14c2afd8ae2b6a3d0c4aac8fd563668b0..c341b4601bfd9d9472c13be051a0d3effec43843 100644 GIT binary patch delta 69 zcmZoMXffCjz{J#+GtlX5l- za)_~PR^aGmUd+zHF|mP#8>Eb#!Gytp!FX~4ix?lHEKp$He=uNRn9RdctC_)&$q>&_ z#E{RB1jKp_=|FxO#Jv0@kd;8}2(*lEat+Hyer|>wpsI8r)@3MW$ORe7#@G!qbg~kw zwX`76G5HKB42cXSK&;D<2IQ3j#ZnlGfl9?$)4?i(SnYNBP*lbPRp$XM#%ev|&&f@! zsfK(&3sZsWiWrg^GJsCTql4)x*q%GA-i$jYYp@lnOH@}IS(@o6SeVr6C{!C77#Zs* zn46o`)^c))D(hPZ#b@W_=H+)y-p?k_*gg3^+x*R!d90baB)Ea*xPpQm7_{G+C-aMV VPWI>F-~fg^C`K4I$Mei#1^{+FUm^ei delta 223 zcmZp1XfcprU|?W$DortDU=RQ@Ie-{Mvv5r;6q~50D9R6#2a6Rk=rSZRqytHljfKmZ z8Tlt$3Di!0E3jnpaY2L0mO>_zR|O$LsVJcIw(FnCpRy@6KFih2A~ySzzd~eRM%t^k@*wLIv2BZa0oI(LS`lPGaUsBlUf~x vYC{7fV;u!^bF - +
Copyright © Greater Chennai Corporation | All rights reserved Coded By BonTon Softwares Pvt Ltd diff --git a/src/main/resources/templates/fragments/modules/base/header.html b/src/main/resources/templates/fragments/modules/base/header.html index eab64c3..b0b97bb 100644 --- a/src/main/resources/templates/fragments/modules/base/header.html +++ b/src/main/resources/templates/fragments/modules/base/header.html @@ -2,19 +2,22 @@
- -
diff --git a/src/main/resources/templates/fragments/modules/base/menu.html b/src/main/resources/templates/fragments/modules/base/menu.html index 8276da1..a83aab5 100644 --- a/src/main/resources/templates/fragments/modules/base/menu.html +++ b/src/main/resources/templates/fragments/modules/base/menu.html @@ -7,7 +7,7 @@
GCC APP - +
diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 1ce6d56..f492ada 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -24,8 +24,8 @@
-
Main Module Name
- Any Discription needed pls add here :) +
Dashboard
+ Main Dashboard of GCC App
@@ -42,12 +42,50 @@
-
-
-
-

Page Title

+
+
+
+

My Details

+
+ +
-
+
+ The body of the widget +
+
+
+
+
+
+

தினம் ஒரு திருக்குறள்:

+
+ +
+
+ +
+ + + + + +
+
அகர முதல எழுத்தெல்லாம
+
ஆதி பகவன் முதற்றே உலக
+
( குறள் எண் : 6 ) | விளக்கம் +
+
+
+
+ +
+
+
+

Your Info

+
+
+
@@ -58,20 +96,10 @@
-

Datatable Test

+

User Profile

-
- - - - - - - - - -
NamePositionOfficeAgeStart dateSalary
NamePositionOfficeAgeStart dateSalary
+
@@ -88,5 +116,102 @@ + diff --git a/src/main/resources/templates/modules/admin/user-group-access.html b/src/main/resources/templates/modules/admin/user-group-access.html index b46a0cc..0a5b22e 100644 --- a/src/main/resources/templates/modules/admin/user-group-access.html +++ b/src/main/resources/templates/modules/admin/user-group-access.html @@ -238,7 +238,7 @@ var submitCheckedData = function(checkedData, groupId) { // Perform your AJAX request here using checkedData // Replace the URL and other options with your actual API endpoint and data - const apiUrl = "/api/saveGroupAccessData"; + const apiUrl = "/gcc/api/saveGroupAccessData"; const selectedGroup = $('#search_groupid'); const selectedGroupName = selectedGroup.find('option:selected').text(); diff --git a/src/main/resources/templates/modules/admin/user-list.html b/src/main/resources/templates/modules/admin/user-list.html index f4e524f..9973386 100644 --- a/src/main/resources/templates/modules/admin/user-list.html +++ b/src/main/resources/templates/modules/admin/user-list.html @@ -202,7 +202,7 @@ } function getUserDetails(userid){ - const apiUrl = "/api/getUserProfile"; + const apiUrl = "/gcc/api/getUserProfile"; return new Promise((resolve, reject) => { $.ajax({ url: apiUrl, diff --git a/src/main/resources/templates/modules/mtm/index.html b/src/main/resources/templates/modules/mtm/index.html index ffa9d79..bb10a7f 100644 --- a/src/main/resources/templates/modules/mtm/index.html +++ b/src/main/resources/templates/modules/mtm/index.html @@ -128,9 +128,9 @@
- - - + + + - - - + + + diff --git a/src/main/resources/templates/modules/petregistration/license-issued.html b/src/main/resources/templates/modules/petregistration/license-issued.html index 4a5d54c..c28adee 100644 --- a/src/main/resources/templates/modules/petregistration/license-issued.html +++ b/src/main/resources/templates/modules/petregistration/license-issued.html @@ -385,7 +385,7 @@ function petimg(mobno, uniqueid) { $.ajax({ type: "GET", - url: '/api/pet/getpetimg', + url: '/gcc/api/pet/getpetimg', data: { 'mobno': mobno, 'uniqueid': uniqueid @@ -403,7 +403,7 @@ function certificateimg(mobno, uniqueid) { $.ajax({ type: "GET", - url: '/api/pet/getvacimg', + url: '/gcc/api/pet/getvacimg', data: { 'mobno': mobno, 'uniqueid': uniqueid @@ -424,7 +424,7 @@ let own; $.ajax({ type: "GET", - url: '/api/pet/getpetOwner', + url: '/gcc/api/pet/getpetOwner', data: { 'mobilenum': mobilenum }, success: function (bodyMessage) { ownercall(bodyMessage); @@ -464,7 +464,7 @@ function licenceInfo(mobno, uniqueid) { $.ajax({ type: "GET", - url: '/api/pet/getlicenseinfo', + url: '/gcc/api/pet/getlicenseinfo', data: { 'mobilenum': mobno, 'uniqueid': uniqueid @@ -492,7 +492,7 @@ //window.open('/owners/getlicensebymobo/'+id+'/'+phone,'_blank'); $.ajax({ type: "GET", - url: '/owners/ /' + id + '/' + phone, + url: '/gcc/pet/owners/ /' + id + '/' + phone, success: function (bodyMessage) { $("#htmldatatxt").html(bodyMessage); $('#getpetlic').modal({ @@ -521,12 +521,12 @@ var x = document.getElementById("fromdate").value; var y = document.getElementById("todate").value; - var url = '/pet/licenseIssued?fromDate=' + x + '&toDate=' + y; + var url = '/gcc/pet/licenseIssued?fromDate=' + x + '&toDate=' + y; window.location.href = url; } function resetDate() { - var url = '/pet/licenseIssued'; + var url = '/gcc/pet/licenseIssued'; window.location.href = url; } diff --git a/src/main/resources/templates/modules/petregistration/rejected.html b/src/main/resources/templates/modules/petregistration/rejected.html index 4d60216..15add3d 100644 --- a/src/main/resources/templates/modules/petregistration/rejected.html +++ b/src/main/resources/templates/modules/petregistration/rejected.html @@ -385,7 +385,7 @@ $(document).ready(function() { function petimg(mobno,uniqueid){ $.ajax({ type: "GET", - url: '/api/pet/getpetimg', + url: '/gcc/api/pet/getpetimg', data: { 'mobno':mobno, 'uniqueid':uniqueid @@ -405,7 +405,7 @@ $(document).ready(function() { function applicantimg(mobno,uniqueid){ $.ajax({ type: "GET", - url: '/api/pet/getapplicantimg', + url: '/gcc/api/pet/getapplicantimg', data: { 'mobno':mobno, 'uniqueid':uniqueid @@ -424,7 +424,7 @@ $(document).ready(function() { function certificateimg(mobno,uniqueid){ $.ajax({ type: "GET", - url: '/api/pet/getvacimg', + url: '/gcc/api/pet/getvacimg', data: { 'mobno':mobno, 'uniqueid':uniqueid @@ -443,7 +443,7 @@ $(document).ready(function() { function proofimg(mobno,uniqueid){ $.ajax({ type: "GET", - url: '/api/pet/getaddproofimg', + url: '/gcc/api/pet/getaddproofimg', data: { 'mobno':mobno, 'uniqueid':uniqueid @@ -473,7 +473,7 @@ $(document).ready(function() { if (result.isConfirmed) { $.ajax({ type: "GET", - url: '/api/accept', + url: '/gcc/api/accept', data: {'id':id}, success: function(bodyMessage) { @@ -499,7 +499,7 @@ $(document).ready(function() { function reject(uniqueid){ $.ajax({ type: "GET", - url: '/api/pet/getpetInfo', + url: '/gcc/api/pet/getpetInfo', data: { 'petid':uniqueid }, @@ -540,7 +540,7 @@ $(document).ready(function() { let own; $.ajax({ type: "GET", - url: '/api/pet/getpetOwner', + url: '/gcc/api/pet/getpetOwner', data: {'mobilenum':mobilenum }, success: function(bodyMessage) { ownercall(bodyMessage); @@ -594,12 +594,12 @@ $(document).ready(function() { var x= document.getElementById("fromdate").value; var y= document.getElementById("todate").value; - var url= '/pet/rejectedPets?fromDate='+x+'&toDate='+y; + var url= '/gcc/pet/rejectedPets?fromDate='+x+'&toDate='+y; window.location.href=url; } function resetDate(){ - var url= '/pet/rejectedPets'; + var url= '/gcc/pet/rejectedPets'; window.location.href=url; } diff --git a/src/main/resources/templates/modules/petregistration/request-list.html b/src/main/resources/templates/modules/petregistration/request-list.html index 0571080..3d2d33b 100644 --- a/src/main/resources/templates/modules/petregistration/request-list.html +++ b/src/main/resources/templates/modules/petregistration/request-list.html @@ -421,7 +421,7 @@ alert(mobno + " "+uniqueid); $.ajax({ type: "GET", - url: '/api/petregistration/getpetimg', + url: '/gcc/api/petregistration/getpetimg', data: { 'mobno': mobno, 'uniqueid': uniqueid @@ -442,7 +442,7 @@ function applicantimg(mobno, uniqueid) { $.ajax({ type: "GET", - url: '/api/petregistration/getapplicantimg', + url: '/gcc/api/petregistration/getapplicantimg', data: { 'mobno': mobno, 'uniqueid': uniqueid @@ -461,7 +461,7 @@ function certificateimg(mobno, uniqueid) { $.ajax({ type: "GET", - url: '/api/petregistration/getvaccineimg', + url: '/gcc/api/petregistration/getvaccineimg', data: { 'mobno': mobno, 'uniqueid': uniqueid @@ -480,7 +480,7 @@ function proofimg(mobno, uniqueid) { $.ajax({ type: "GET", - url: '/api/petregistration/getaddressproofimg', + url: '/gcc/api/petregistration/getaddressproofimg', data: { 'mobno': mobno, 'uniqueid': uniqueid @@ -510,7 +510,7 @@ if (result.isConfirmed) { $.ajax({ type: "GET", - url: '/api/pet/accept', + url: '/gcc/api/pet/accept', data: { 'id': id, 'mobileNo': mobileNo }, success: function (bodyMessage) { if (bodyMessage == "success") { @@ -534,7 +534,7 @@ function reject(uniqueid) { $.ajax({ type: "GET", - url: '/api/pet/getpetInfo', + url: '/gcc/api/pet/getpetInfo', data: { 'petid': uniqueid }, @@ -616,7 +616,7 @@ let own; $.ajax({ type: "GET", - url: '/api/pet/getpetOwner', + url: '/gcc/api/pet/getpetOwner', data: { 'mobilenum': mobilenum }, success: function (bodyMessage) { ownercall(bodyMessage); @@ -673,12 +673,12 @@ var x = document.getElementById("fromdate").value; var y = document.getElementById("todate").value; - var url = '/petregistration/requestlist?fromDate=' + x + '&toDate=' + y; + var url = '/gcc/pet/petregistration/requestlist?fromDate=' + x + '&toDate=' + y; window.location.href = url; } function resetDate() { - var url = '/petregistration/requestlist'; + var url = '/gcc/pet/petregistration/requestlist'; window.location.href = url; } diff --git a/src/main/resources/templates/modules/pgr/all-list.html b/src/main/resources/templates/modules/pgr/all-list.html index 88ff795..f027ba8 100644 --- a/src/main/resources/templates/modules/pgr/all-list.html +++ b/src/main/resources/templates/modules/pgr/all-list.html @@ -64,6 +64,8 @@ Date Time Status + Department + Mode @@ -81,6 +83,8 @@ Date Time Status + Department + Mode @@ -238,8 +242,8 @@ ], scrollY: '50vh', fixedColumns: { - left: 1, - right: 1 + left: 0, + right: 0 }, buttons: [buttons], responsive: true, @@ -264,7 +268,9 @@ row['LOCATION'], row['COMPDATE'], row['TIME'], - row['STATUS'] + row['STATUS'], + row['DEPT_NAME'], + row['MODE'] ]).draw(false); }); diff --git a/src/main/resources/templates/modules/pgr/index.html b/src/main/resources/templates/modules/pgr/index.html index 319a505..08bbd90 100644 --- a/src/main/resources/templates/modules/pgr/index.html +++ b/src/main/resources/templates/modules/pgr/index.html @@ -3,7 +3,7 @@ - + @@ -90,13 +90,13 @@ - - - - - - - + + + + + + + - - - - - + + + + +