Search in sources :

Example 6 with RequiresPermissions

use of com.ruoyi.common.security.annotation.RequiresPermissions in project RuoYi-Cloud-Oracle by yangzongzhuan.

the class GenController method getInfo.

/**
 * 修改代码生成业务
 */
@RequiresPermissions("tool:gen:query")
@GetMapping(value = "/{tableId}")
public AjaxResult getInfo(@PathVariable Long tableId) {
    GenTable table = genTableService.selectGenTableById(tableId);
    List<GenTable> tables = genTableService.selectGenTableAll();
    List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("info", table);
    map.put("rows", list);
    map.put("tables", tables);
    return AjaxResult.success(map);
}
Also used : GenTable(com.ruoyi.gen.domain.GenTable) HashMap(java.util.HashMap) GenTableColumn(com.ruoyi.gen.domain.GenTableColumn) RequiresPermissions(com.ruoyi.common.security.annotation.RequiresPermissions) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 7 with RequiresPermissions

use of com.ruoyi.common.security.annotation.RequiresPermissions in project RuoYi-Cloud-Oracle by yangzongzhuan.

the class SysJobController method changeStatus.

/**
 * 定时任务状态修改
 */
@RequiresPermissions("monitor:job:changeStatus")
@Log(title = "定时任务", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException {
    SysJob newJob = jobService.selectJobById(job.getJobId());
    newJob.setStatus(job.getStatus());
    return toAjax(jobService.changeStatus(newJob));
}
Also used : SysJob(com.ruoyi.job.domain.SysJob) RequiresPermissions(com.ruoyi.common.security.annotation.RequiresPermissions) Log(com.ruoyi.common.log.annotation.Log) PutMapping(org.springframework.web.bind.annotation.PutMapping)

Example 8 with RequiresPermissions

use of com.ruoyi.common.security.annotation.RequiresPermissions in project RuoYi-Cloud-Oracle by yangzongzhuan.

the class PreAuthorizeAspect method checkMethodAnnotation.

/**
 * 对一个Method对象进行注解检查
 */
public void checkMethodAnnotation(Method method) {
    // 校验 @RequiresLogin 注解
    RequiresLogin requiresLogin = method.getAnnotation(RequiresLogin.class);
    if (requiresLogin != null) {
        AuthUtil.checkLogin();
    }
    // 校验 @RequiresRoles 注解
    RequiresRoles requiresRoles = method.getAnnotation(RequiresRoles.class);
    if (requiresRoles != null) {
        AuthUtil.checkRole(requiresRoles);
    }
    // 校验 @RequiresPermissions 注解
    RequiresPermissions requiresPermissions = method.getAnnotation(RequiresPermissions.class);
    if (requiresPermissions != null) {
        AuthUtil.checkPermi(requiresPermissions);
    }
}
Also used : RequiresPermissions(com.ruoyi.common.security.annotation.RequiresPermissions) RequiresLogin(com.ruoyi.common.security.annotation.RequiresLogin) RequiresRoles(com.ruoyi.common.security.annotation.RequiresRoles)

Example 9 with RequiresPermissions

use of com.ruoyi.common.security.annotation.RequiresPermissions in project RuoYi-Cloud by yangzongzhuan.

the class GenController method getInfo.

/**
 * 修改代码生成业务
 */
@RequiresPermissions("tool:gen:query")
@GetMapping(value = "/{tableId}")
public AjaxResult getInfo(@PathVariable Long tableId) {
    GenTable table = genTableService.selectGenTableById(tableId);
    List<GenTable> tables = genTableService.selectGenTableAll();
    List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(tableId);
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("info", table);
    map.put("rows", list);
    map.put("tables", tables);
    return AjaxResult.success(map);
}
Also used : GenTable(com.ruoyi.gen.domain.GenTable) HashMap(java.util.HashMap) GenTableColumn(com.ruoyi.gen.domain.GenTableColumn) RequiresPermissions(com.ruoyi.common.security.annotation.RequiresPermissions) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 10 with RequiresPermissions

use of com.ruoyi.common.security.annotation.RequiresPermissions in project RuoYi-Cloud by yangzongzhuan.

the class SysDeptController method excludeChild.

/**
 * 查询部门列表(排除节点)
 */
@RequiresPermissions("system:dept:list")
@GetMapping("/list/exclude/{deptId}")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
    List<SysDept> depts = deptService.selectDeptList(new SysDept());
    Iterator<SysDept> it = depts.iterator();
    while (it.hasNext()) {
        SysDept d = (SysDept) it.next();
        if (d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")) {
            it.remove();
        }
    }
    return AjaxResult.success(depts);
}
Also used : SysDept(com.ruoyi.system.api.domain.SysDept) RequiresPermissions(com.ruoyi.common.security.annotation.RequiresPermissions) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

RequiresPermissions (com.ruoyi.common.security.annotation.RequiresPermissions)14 GetMapping (org.springframework.web.bind.annotation.GetMapping)10 Log (com.ruoyi.common.log.annotation.Log)6 LoginUser (com.ruoyi.system.api.model.LoginUser)6 PutMapping (org.springframework.web.bind.annotation.PutMapping)6 UserConstants (com.ruoyi.common.core.constant.UserConstants)4 R (com.ruoyi.common.core.domain.R)4 StringUtils (com.ruoyi.common.core.utils.StringUtils)4 ExcelUtil (com.ruoyi.common.core.utils.poi.ExcelUtil)4 BaseController (com.ruoyi.common.core.web.controller.BaseController)4 AjaxResult (com.ruoyi.common.core.web.domain.AjaxResult)4 TableDataInfo (com.ruoyi.common.core.web.page.TableDataInfo)4 BusinessType (com.ruoyi.common.log.enums.BusinessType)4 InnerAuth (com.ruoyi.common.security.annotation.InnerAuth)4 SecurityUtils (com.ruoyi.common.security.utils.SecurityUtils)4 SysRole (com.ruoyi.system.api.domain.SysRole)4 SysUser (com.ruoyi.system.api.domain.SysUser)4 ISysConfigService (com.ruoyi.system.service.ISysConfigService)4 ISysPermissionService (com.ruoyi.system.service.ISysPermissionService)4 ISysPostService (com.ruoyi.system.service.ISysPostService)4