All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.herodotus.stirrup.rest.servlet.upms.controller.security.SysDefaultRoleController Maven / Gradle / Ivy

The newest version!
/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2020-2030 郑庚伟 ZHENGGENGWEI (码匠君),  Licensed under the AGPL License
 *
 * This file is part of Herodotus Stirrup.
 *
 * Herodotus Stirrup is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Herodotus Stirrup is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see .
 */

package cn.herodotus.stirrup.rest.servlet.upms.controller.security;

import cn.herodotus.stirrup.core.definition.domain.Result;
import cn.herodotus.stirrup.data.crud.service.JpaWriteableService;
import cn.herodotus.stirrup.logic.upms.entity.security.SysDefaultRole;
import cn.herodotus.stirrup.logic.upms.service.security.SysDefaultRoleService;
import cn.herodotus.stirrup.web.api.servlet.AbstractJpaWriteableController;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tags;
import jakarta.validation.constraints.NotBlank;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 

Description: 系统默认角色管理接口

* * @author : gengwei.zheng * @date : 2021/7/21 16:12 */ @RestController @RequestMapping("/security/default-role") @Tags({ @Tag(name = "用户安全管理接口"), @Tag(name = "系统默认角色管理接口") }) public class SysDefaultRoleController extends AbstractJpaWriteableController { private final SysDefaultRoleService sysDefaultRoleService; public SysDefaultRoleController(SysDefaultRoleService sysDefaultRoleService) { this.sysDefaultRoleService = sysDefaultRoleService; } @Override public JpaWriteableService getWriteableService() { return this.sysDefaultRoleService; } @Operation(summary = "设置默认角色", description = "给不同的登录场景设置不同的默认角色", requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(content = @Content(mediaType = "application/x-www-form-urlencoded")), responses = {@ApiResponse(description = "已保存数据", content = @Content(mediaType = "application/json"))}) @Parameters({ @Parameter(name = "defaultId", required = true, description = "默认角色类型ID"), @Parameter(name = "roleId", required = true, description = "设置的角色ID") }) @PutMapping public Result assign(@RequestParam(name = "defaultId") @NotBlank String defaultId, @RequestParam(name = "roleId") @NotBlank String roleId) { SysDefaultRole sysDefaultRole = sysDefaultRoleService.assign(defaultId, roleId); return result(sysDefaultRole); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy