角色权限模块处理

master
shijie 4 years ago
parent 37191fda92
commit d18b905343
  1. 22
      dq-financial-hrms-auth/pom.xml
  2. 14
      dq-financial-hrms/pom.xml
  3. 5
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java
  4. 2
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/UserController.java
  5. 1
      dq-framework-common/pom.xml
  6. 10
      dq-govern-gateway/pom.xml

@ -72,6 +72,16 @@
<version>5.3.4.RELEASE</version> <version>5.3.4.RELEASE</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- <dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
@ -91,7 +101,19 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration >
<classifier>exec</classifier>
</configuration>
</plugin> </plugin>
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>-->
</plugins> </plugins>
</build> </build>

@ -39,12 +39,12 @@
<artifactId>ooxml-schemas</artifactId> <artifactId>ooxml-schemas</artifactId>
<version>1.0</version> <version>1.0</version>
</dependency> </dependency>
<!--<dependency> <dependency>
<groupId>com.daqing.financial</groupId> <groupId>com.daqing.financial</groupId>
<artifactId>dq-financial-hrms-auth</artifactId> <artifactId>dq-financial-hrms-auth</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<scope>compile</scope> <scope>compile</scope>
</dependency>--> </dependency>
<!-- <dependency> <!-- <dependency>
<groupId>org.springframework.security</groupId> <groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId> <artifactId>spring-security-core</artifactId>
@ -70,6 +70,16 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>

@ -1,6 +1,9 @@
package com.daqing.financial.hrms.controller; package com.daqing.financial.hrms.controller;
import com.daqing.financial.hrauth.annotation.Log;
import com.daqing.financial.hrauth.enums.OperationType;
import com.daqing.financial.hrauth.enums.OperationUnit;
import com.daqing.financial.hrms.EmployeeControllerApi; import com.daqing.financial.hrms.EmployeeControllerApi;
import com.daqing.financial.hrms.service.EmployeeService; import com.daqing.financial.hrms.service.EmployeeService;
import com.daqing.framework.domain.crms.request.EmployeeDisableRequest; import com.daqing.framework.domain.crms.request.EmployeeDisableRequest;
@ -41,7 +44,7 @@ public class EmployeeController implements EmployeeControllerApi {
private EmployeeService employeeService; private EmployeeService employeeService;
@GetMapping("/list") @GetMapping("/list")
//@Log(detail = "员工列表",level = 3,operationUnit = OperationUnit.ROLE,operationType = OperationType.INSERT) @Log(detail = "员工列表",level = 3,operationUnit = OperationUnit.ROLE,operationType = OperationType.INSERT)
//@RequiresPermissions("hrms:employee:info") //@RequiresPermissions("hrms:employee:info")
public ResponseResult list(@RequestParam("page") Integer page, public ResponseResult list(@RequestParam("page") Integer page,
@RequestParam("size") Integer size, @RequestParam("size") Integer size,

@ -125,6 +125,8 @@ public class UserController implements UserControllerApi {
* @return * @return
*/ */
/* @GetMapping(value = "get") /* @GetMapping(value = "get")
// 访问路径`/admin` 具有`ADMIN`角色权限 【这种是写死方式】
// @PreAuthorize("hasPermission('/admin','ADMIN')")
@PreAuthorize("hasAnyRole('ROLE_ADMIN')") @PreAuthorize("hasAnyRole('ROLE_ADMIN')")
public Object get(Authentication authentication){ public Object get(Authentication authentication){
//Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); //Authentication authentication = SecurityContextHolder.getContext().getAuthentication();

@ -26,7 +26,6 @@
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

@ -78,6 +78,16 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>

Loading…
Cancel
Save