Skip to content

Commit 45cfe34

Browse files
vijayanasokanglaumtech
authored andcommitted
Update CustomerController.java
Sample controller endpoint is added wiht aspect
1 parent 5ad3b3c commit 45cfe34

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed
Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,51 @@
11
package com.glaum.login.controller;
22

3-
import com.glaum.login.model.User;
43
import org.slf4j.Logger;
54
import org.slf4j.LoggerFactory;
5+
import org.springframework.beans.factory.annotation.Autowired;
66
import org.springframework.security.access.prepost.PreAuthorize;
77
import org.springframework.stereotype.Controller;
88
import org.springframework.ui.Model;
9+
import org.springframework.web.bind.annotation.PathVariable;
910
import org.springframework.web.bind.annotation.RequestMapping;
1011
import org.springframework.web.bind.annotation.RequestMethod;
1112

13+
import com.glaum.login.configuration.Authorized;
14+
import com.glaum.login.entity.permission;
15+
1216
import java.io.IOException;
17+
import java.util.List;
1318
import java.util.Map;
1419

20+
import javax.servlet.http.HttpServletRequest;
21+
import javax.servlet.http.HttpServletResponse;
22+
import javax.servlet.http.HttpSession;
23+
1524
@Controller
1625
public class CustomerController {
1726

27+
@Autowired
28+
HttpSession httpsessionobj;
29+
30+
31+
1832
private static final Logger LOGGER = LoggerFactory.getLogger(CustomerController.class);
19-
33+
34+
//@PreAuthorize("hasPermission('customer', #httpSession)")
2035
@RequestMapping(value={"/customer"}, method = RequestMethod.GET)
21-
public String customer() throws IOException {
36+
@Authorized(keys = "view_dashboard")
37+
public String customer(HttpSession httpSession,HttpServletRequest request,HttpServletResponse res) throws IOException {
38+
39+
return "admin_customer";
40+
}
41+
42+
@RequestMapping(value={"/quote_delete"}, method = RequestMethod.GET)
43+
@Authorized(keys = {"quote_delete","quote_read","quote_create"})
44+
public String customerdel(HttpSession httpSession,HttpServletRequest request,HttpServletResponse res) throws IOException {
45+
2246
return "admin_customer";
2347
}
48+
49+
2450

2551
}

0 commit comments

Comments
 (0)