mirror of https://gitee.com/topiam/eiam
Merge remote-tracking branch 'origin/master'
commit
73034be019
|
@ -31,6 +31,7 @@ import cn.topiam.employee.common.entity.app.AppJwtConfigEntity;
|
|||
import cn.topiam.employee.common.entity.app.po.AppJwtConfigPO;
|
||||
import cn.topiam.employee.core.help.ServerHelp;
|
||||
import static cn.topiam.employee.common.constant.ProtocolConstants.APP_CODE;
|
||||
import static cn.topiam.employee.common.constant.ProtocolConstants.JwtEndpointConstants.JWT_SLO_PATH;
|
||||
import static cn.topiam.employee.common.constant.ProtocolConstants.JwtEndpointConstants.JWT_SSO_PATH;
|
||||
|
||||
/**
|
||||
|
@ -98,6 +99,8 @@ public interface AppJwtConfigConverter {
|
|||
StringSubstitutor sub = new StringSubstitutor(variables, "{", "}");
|
||||
//IDP SSO 端点
|
||||
domain.setIdpSsoEndpoint(sub.replace(ServerHelp.getPortalPublicBaseUrl()+JWT_SSO_PATH));
|
||||
//IDP SLO 端点
|
||||
domain.setIdpSloEndpoint(sub.replace(ServerHelp.getPortalPublicBaseUrl()+JWT_SLO_PATH));
|
||||
return domain;
|
||||
//@formatter:on
|
||||
}
|
||||
|
|
|
@ -43,4 +43,10 @@ public class AppJwtProtocolEndpoint implements Serializable {
|
|||
*/
|
||||
@Parameter(description = "IDP SSO 端点")
|
||||
private String idpSsoEndpoint;
|
||||
|
||||
/**
|
||||
* IDP SLO 端点
|
||||
*/
|
||||
@Parameter(description = "IDP SLO 端点")
|
||||
private String idpSloEndpoint;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ public class AppOidcStandardSaveConfigParam implements Serializable {
|
|||
/**
|
||||
* 登出重定向URI
|
||||
*/
|
||||
@NotNull(message = "登出重定向URI不能为空")
|
||||
@Schema(description = "登出重定向URI")
|
||||
private List<@NotBlank(message = "登出重定向URI不能为空") @URL(message = "登出重定向URI格式不正确") String> postLogoutRedirectUris;
|
||||
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
package cn.topiam.employee.common.constant;
|
||||
|
||||
import static cn.topiam.employee.support.constant.EiamConstants.COLON;
|
||||
import static cn.topiam.employee.support.constant.EiamConstants.V1_API_PATH;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author SanLi
|
||||
* Created by qinggang.zuo@gmail.com / 2689170096@qq.com on 2023/9/18 14:35
|
||||
*/
|
||||
public class PermissionConstants {
|
||||
|
||||
/**
|
||||
* 权限管理API路径
|
||||
*/
|
||||
public final static String PERMISSION_PATH = V1_API_PATH + "/permission";
|
||||
|
||||
/**
|
||||
* 组名称
|
||||
*/
|
||||
public static final String PERMISSION_GROUP_NAME = "应用管理";
|
||||
|
||||
/**
|
||||
* 权限管理配置缓存前缀
|
||||
*/
|
||||
public static final String PERMISSION_CACHE_NAME_PREFIX = "permission" + COLON;
|
||||
}
|
|
@ -237,6 +237,11 @@ public final class ProtocolConstants {
|
|||
*/
|
||||
public static final String JWT_SSO_PATH = JWT_AUTHORIZE_BASE_PATH + "/sso";
|
||||
|
||||
/**
|
||||
* JWT_SLO
|
||||
*/
|
||||
public static final String JWT_SLO_PATH = JWT_AUTHORIZE_BASE_PATH + "/slo";
|
||||
|
||||
/**
|
||||
* JWT IDP SSO 发起
|
||||
*/
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
* eiam-common - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.entity.app.query;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyEffect;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyObjectType;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicySubjectType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 分页查询策略入参
|
||||
*
|
||||
* @author TopIAM
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "查询权限策略列表入参")
|
||||
@ParameterObject
|
||||
public class AppPolicyQuery implements Serializable {
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@NotNull(message = "资源所属应用不能为空")
|
||||
@Parameter(description = "所属应用")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 授权主体Id
|
||||
*/
|
||||
@Parameter(description = "授权主体Id")
|
||||
private String subjectId;
|
||||
|
||||
/**
|
||||
* 权限主体类型(用户、角色、分组、组织机构)
|
||||
*/
|
||||
@NotNull(message = "授权主体类型不能为空")
|
||||
@Parameter(description = "授权主体类型")
|
||||
private AppPolicySubjectType subjectType;
|
||||
|
||||
/**
|
||||
* 授权客体Id
|
||||
*/
|
||||
@Parameter(description = "授权客体Id")
|
||||
private String objectId;
|
||||
|
||||
/**
|
||||
* 权限客体类型(权限、角色)
|
||||
*/
|
||||
@NotNull(message = "授权客体类型不能为空")
|
||||
@Parameter(description = "授权客体类型")
|
||||
private AppPolicyObjectType objectType;
|
||||
|
||||
/**
|
||||
* 规则效果
|
||||
*/
|
||||
@Parameter(description = "规则效果")
|
||||
private AppPolicyEffect effect;
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
* eiam-common - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.entity.permission;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import cn.topiam.employee.common.enums.PermissionActionType;
|
||||
import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
|
||||
import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
|
||||
|
||||
/**
|
||||
* 应用权限
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2021/11/2 21:05
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Entity
|
||||
@Accessors(chain = true)
|
||||
@Table(name = "app_permission_action")
|
||||
@SQLDelete(sql = "update app_permission_action set " + SOFT_DELETE_SET + " where id_ = ?")
|
||||
@Where(clause = SOFT_DELETE_WHERE)
|
||||
public class PermissionActionEntity extends LogicDeleteEntity<Long> {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -3954680915360748087L;
|
||||
|
||||
/**
|
||||
* 权限值
|
||||
*/
|
||||
@Column(name = "value_")
|
||||
private String value;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Column(name = "name_")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
@Column(name = "type_")
|
||||
private PermissionActionType type;
|
||||
|
||||
/**
|
||||
* 资源
|
||||
*/
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "resource_id")
|
||||
private PermissionResourceEntity resource;
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
* eiam-common - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.entity.permission;
|
||||
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyEffect;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyObjectType;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicySubjectType;
|
||||
import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
|
||||
import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
|
||||
|
||||
/**
|
||||
* 应用策略
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2021/11/4 19:41
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Entity
|
||||
@Accessors(chain = true)
|
||||
@Table(name = "app_permission_policy")
|
||||
@SQLDelete(sql = "update app_permission_policy set " + SOFT_DELETE_SET + " where id_ = ?")
|
||||
@Where(clause = SOFT_DELETE_WHERE)
|
||||
public class PermissionPolicyEntity extends LogicDeleteEntity<Long> {
|
||||
|
||||
/**
|
||||
* 应用id
|
||||
*/
|
||||
@Column(name = "app_id")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 权限主体ID(用户、角色、分组、组织机构)
|
||||
*/
|
||||
@Column(name = "subject_id")
|
||||
private String subjectId;
|
||||
/**
|
||||
* 权限主体类型(用户、角色、分组、组织机构)
|
||||
*/
|
||||
@Column(name = "subject_type")
|
||||
private AppPolicySubjectType subjectType;
|
||||
/**
|
||||
* 权限客体ID(权限、角色)
|
||||
*/
|
||||
@Column(name = "object_id")
|
||||
private Long objectId;
|
||||
/**
|
||||
* 权限客体类型(权限、角色)
|
||||
*/
|
||||
@Column(name = "object_type")
|
||||
private AppPolicyObjectType objectType;
|
||||
/**
|
||||
* Effect
|
||||
*/
|
||||
@Column(name = "effect_")
|
||||
private AppPolicyEffect effect;
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
/*
|
||||
* eiam-common - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.entity.permission;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
|
||||
import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
|
||||
|
||||
import static jakarta.persistence.FetchType.LAZY;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 应用资源关联
|
||||
* </p>
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020-08-10
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Entity
|
||||
@Accessors(chain = true)
|
||||
@Table(name = "app_permission_resource")
|
||||
@SQLDelete(sql = "update app_permission_resource set " + SOFT_DELETE_SET + " where id_ = ?")
|
||||
@Where(clause = SOFT_DELETE_WHERE)
|
||||
public class PermissionResourceEntity extends LogicDeleteEntity<Long> {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 7342074686605139968L;
|
||||
|
||||
/**
|
||||
* 资源编码
|
||||
*/
|
||||
@Column(name = "code_")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
@Column(name = "name_")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
@Column(name = "app_id")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Column(name = "desc_")
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Column(name = "is_enabled")
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 权限
|
||||
*/
|
||||
@ToString.Exclude
|
||||
@OneToMany(mappedBy = "resource", fetch = LAZY, cascade = { CascadeType.PERSIST,
|
||||
CascadeType.REMOVE })
|
||||
private List<PermissionActionEntity> actions;
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
* eiam-common - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.entity.permission;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import org.hibernate.annotations.SQLDelete;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
import cn.topiam.employee.support.repository.domain.LogicDeleteEntity;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
|
||||
import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_WHERE;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 应用角色表
|
||||
* </p>
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020-08-10
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@Entity
|
||||
@Accessors(chain = true)
|
||||
@Table(name = "app_permission_role")
|
||||
@SQLDelete(sql = "update app_permission_role set " + SOFT_DELETE_SET + " where id_ = ?")
|
||||
@Where(clause = SOFT_DELETE_WHERE)
|
||||
public class PermissionRoleEntity extends LogicDeleteEntity<Long> {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -7761332532995424593L;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@Column(name = "name_")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
@Column(name = "code_")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
@Column(name = "app_id")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Column(name = "is_enabled")
|
||||
private Boolean enabled;
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* eiam-common - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.entity.permission.po;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyEffect;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyObjectType;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicySubjectType;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 策略分页查询结果
|
||||
*
|
||||
* @author TopIAM
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "分页查询策略响应")
|
||||
public class PermissionPolicyPO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3320953184046791392L;
|
||||
|
||||
/**
|
||||
* 授权主体名称
|
||||
*/
|
||||
@Parameter(description = "授权主体名称")
|
||||
private String subjectName;
|
||||
|
||||
/**
|
||||
* 权限客体名菜
|
||||
*/
|
||||
@Parameter(description = "授权客体名称")
|
||||
private String objectName;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Parameter(description = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 授权主体id
|
||||
*/
|
||||
@Parameter(description = "授权主体id")
|
||||
private String subjectId;
|
||||
|
||||
/**
|
||||
* 权限主体类型(用户、角色、分组、组织机构)
|
||||
*/
|
||||
@Parameter(description = "授权主体类型")
|
||||
private AppPolicySubjectType subjectType;
|
||||
|
||||
/**
|
||||
* 权限客体ID
|
||||
*/
|
||||
@Parameter(description = "授权客体id")
|
||||
private Long objectId;
|
||||
|
||||
/**
|
||||
* 权限客体类型(权限、角色)
|
||||
*/
|
||||
@Parameter(description = "授权客体类型")
|
||||
private AppPolicyObjectType objectType;
|
||||
|
||||
/**
|
||||
* 授权作用
|
||||
*/
|
||||
@Parameter(description = "授权作用")
|
||||
private AppPolicyEffect effect;
|
||||
}
|
|
@ -39,23 +39,7 @@ import static cn.topiam.employee.common.constant.ProtocolConstants.JWT_CONFIG_CA
|
|||
@AllArgsConstructor
|
||||
@CacheConfig(cacheNames = { JWT_CONFIG_CACHE_NAME })
|
||||
public class AppJwtConfigRepositoryCustomizedImpl implements AppJwtConfigRepositoryCustomized {
|
||||
private static final String SELECT_SQL = """
|
||||
SELECT
|
||||
ajc.*,
|
||||
app.init_login_url,
|
||||
app.init_login_type,
|
||||
app.authorization_type,
|
||||
app.template_,
|
||||
app.code_,
|
||||
app.is_enabled,
|
||||
app.client_id,
|
||||
app.client_secret
|
||||
FROM
|
||||
app
|
||||
INNER JOIN app_jwt_config ajc ON app.id_ = ajc.app_id AND ajc.is_deleted = '0'
|
||||
WHERE
|
||||
app.is_deleted = '0'
|
||||
""";
|
||||
private static final String SELECT_SQL = "SELECT ajc.*, app.init_login_url, app.init_login_type, app.authorization_type, app.template_ , app.code_, app.is_enabled, app.client_id, app.client_secret FROM app INNER JOIN app_jwt_config ajc ON app.id_ = ajc.app_id AND ajc.is_deleted = '0' WHERE app.is_deleted = '0'";
|
||||
|
||||
/**
|
||||
* 根据应用ID获取
|
||||
|
|
|
@ -1,130 +0,0 @@
|
|||
/*
|
||||
* eiam-common - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.repository.app.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import cn.topiam.employee.common.entity.app.query.AppPolicyQuery;
|
||||
import cn.topiam.employee.common.repository.app.impl.mapper.AppPermissionPolicyPoMapper;
|
||||
import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepositoryCustomized;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2021/11/4 22:46
|
||||
*/
|
||||
@Repository
|
||||
@RequiredArgsConstructor
|
||||
public class AppPermissionPolicyRepositoryCustomizedImpl implements
|
||||
AppPermissionPolicyRepositoryCustomized {
|
||||
|
||||
private String leftJoin(String table, String condition) {
|
||||
return " LEFT JOIN " + table + " ON " + condition + " AND " + table + ".is_deleted = '0' ";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PermissionPolicyPO> findPage(AppPolicyQuery query, Pageable pageable) {
|
||||
//查询条件
|
||||
//@formatter:off
|
||||
// 所属应用
|
||||
StringBuilder where = new StringBuilder("WHERE policy.is_deleted = '0' AND policy.app_id = '").append(query.getAppId()).append("' ");
|
||||
// 主体类型
|
||||
where.append(" AND policy.subject_type = '").append(query.getSubjectType().getCode()).append("' ");
|
||||
// 客体类型
|
||||
where.append(" AND policy.object_type = '").append(query.getObjectType().getCode()).append("' ");
|
||||
// 主体id
|
||||
if (!ObjectUtils.isEmpty(query.getSubjectId())) {
|
||||
where.append("policy.subject_id = '").append(query.getSubjectId()).append("' ");
|
||||
}
|
||||
// 客体id
|
||||
if (!ObjectUtils.isEmpty(query.getObjectId())) {
|
||||
where.append("policy.object_id = '").append(query.getObjectId()).append("' ");
|
||||
}
|
||||
// 授权效果
|
||||
if (!ObjectUtils.isEmpty(query.getEffect())) {
|
||||
where.append("policy.effect = '").append(query.getEffect().getCode()).append("' ");
|
||||
}
|
||||
|
||||
List<String> fields = Lists.newArrayList("policy.subject_id", "policy.object_id", "policy.subject_type", "policy.object_type", "policy.id", "policy.effect");
|
||||
String subjectJoin;
|
||||
String objectJoin = null;
|
||||
switch (query.getSubjectType()) {
|
||||
case USER -> {
|
||||
subjectJoin = leftJoin("app_account account", "policy.subject_id = account.id");
|
||||
fields.add("account.account as subject_name");
|
||||
}
|
||||
case USER_GROUP -> {
|
||||
subjectJoin = leftJoin("user_group group", "policy.subject_id = group.id");
|
||||
fields.add("group.name as subject_name");
|
||||
}
|
||||
case ORGANIZATION -> {
|
||||
subjectJoin = leftJoin("organization org", "policy.subject_id = org.id");
|
||||
fields.add("org.name as subject_name");
|
||||
}
|
||||
case ROLE -> {
|
||||
subjectJoin = leftJoin("app_permission_role role", "policy.subject_id = role.id");
|
||||
fields.add("role.name as subject_name");
|
||||
}
|
||||
default -> throw new RuntimeException("暂不支持");
|
||||
}
|
||||
switch (query.getObjectType()) {
|
||||
case PERMISSION -> {
|
||||
objectJoin = leftJoin("app_permission_action action", "policy.subject_id = action.id");
|
||||
fields.add("action.name as object_name");
|
||||
}
|
||||
case ROLE -> {
|
||||
objectJoin = leftJoin("app_permission_role role2", "policy.subject_id = role2.id");
|
||||
fields.add("role2.name as object_name");
|
||||
}
|
||||
case RESOURCE -> {
|
||||
objectJoin = leftJoin("app_permission_resource resource", "policy.subject_id = resource.id");
|
||||
fields.add("resource.name as object_name");
|
||||
}
|
||||
}
|
||||
StringBuilder selectSql = new StringBuilder("SELECT ").append(String.join(", ", fields))
|
||||
.append(" FROM app_permission_policy policy ").append(subjectJoin).append(objectJoin);
|
||||
|
||||
// @formatter:off
|
||||
List<PermissionPolicyPO> list = jdbcTemplate
|
||||
.query(
|
||||
selectSql.append(" LIMIT ").append(pageable.getPageNumber() * pageable.getPageSize())
|
||||
.append(",").append(pageable.getPageSize()).toString(),
|
||||
new AppPermissionPolicyPoMapper());
|
||||
//@formatter:off
|
||||
String countSql = "SELECT count(*) FROM (" + selectSql + ") app_policy_";
|
||||
//@formatter:on
|
||||
Integer count = jdbcTemplate.queryForObject(countSql, Integer.class);
|
||||
return new PageImpl<>(list, pageable, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* JdbcTemplate
|
||||
*/
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* eiam-common - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.repository.app.impl.mapper;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyEffect;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyObjectType;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicySubjectType;
|
||||
|
||||
/**
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2022/2/13 23:25
|
||||
*/
|
||||
public class AppPermissionPolicyPoMapper implements RowMapper<PermissionPolicyPO> {
|
||||
|
||||
/**
|
||||
* Implementations must implement this method to map each row of data
|
||||
* in the ResultSet. This method should not call {@code next()} on
|
||||
* the ResultSet; it is only supposed to map values of the current row.
|
||||
*
|
||||
* @param rs the ResultSet to map (pre-initialized for the current row)
|
||||
* @param rowNum the number of the current row
|
||||
* @return the result object for the current row (may be {@code null})
|
||||
* @throws SQLException if an SQLException is encountered getting
|
||||
* column values (that is, there's no need to catch SQLException)
|
||||
*/
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
@Override
|
||||
public PermissionPolicyPO mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
PermissionPolicyPO permissionPolicyPo = new PermissionPolicyPO();
|
||||
permissionPolicyPo.setId(rs.getLong("id_"));
|
||||
permissionPolicyPo.setEffect(AppPolicyEffect.getType(rs.getString("effect")));
|
||||
permissionPolicyPo.setSubjectId(rs.getString("subject_id"));
|
||||
permissionPolicyPo
|
||||
.setSubjectType(AppPolicySubjectType.getType(rs.getString("subject_type")));
|
||||
permissionPolicyPo.setSubjectName(rs.getString("subject_name"));
|
||||
permissionPolicyPo.setObjectId(rs.getLong("object_id"));
|
||||
permissionPolicyPo
|
||||
.setObjectType(AppPolicyObjectType.getType(rs.getString("object_type")));
|
||||
permissionPolicyPo.setObjectName(rs.getString("object_name"));
|
||||
return permissionPolicyPo;
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* eiam-common - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.repository.permission;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.PermissionActionEntity;
|
||||
import cn.topiam.employee.common.entity.permission.PermissionResourceEntity;
|
||||
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import cn.topiam.employee.support.repository.LogicDeleteRepository;
|
||||
|
||||
/**
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2021/11/22 23:06
|
||||
*/
|
||||
@Repository
|
||||
public interface AppPermissionActionRepository extends
|
||||
LogicDeleteRepository<PermissionActionEntity, Long>,
|
||||
QuerydslPredicateExecutor<PermissionActionEntity> {
|
||||
/**
|
||||
* findAllByResource
|
||||
*
|
||||
* @param resource {@link PermissionResourceEntity}
|
||||
* @return {@link List}
|
||||
*/
|
||||
List<PermissionActionEntity> findAllByResource(PermissionResourceEntity resource);
|
||||
}
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
* eiam-common - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.repository.permission;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.PermissionPolicyEntity;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import cn.topiam.employee.support.repository.LogicDeleteRepository;
|
||||
import static cn.topiam.employee.support.repository.domain.LogicDeleteEntity.SOFT_DELETE_SET;
|
||||
|
||||
/**
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2021/11/4 22:44
|
||||
*/
|
||||
@Repository
|
||||
public interface AppPermissionPolicyRepository extends AppPermissionPolicyRepositoryCustomized,
|
||||
LogicDeleteRepository<PermissionPolicyEntity, Long>,
|
||||
QuerydslPredicateExecutor<PermissionPolicyEntity> {
|
||||
/**
|
||||
* 按主体 ID 删除所有
|
||||
*
|
||||
* @param subjectIds {@link String}
|
||||
*/
|
||||
@Modifying
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Query(value = "UPDATE app_permission_policy SET " + SOFT_DELETE_SET
|
||||
+ " WHERE subject_id IN (:subjectIds)", nativeQuery = true)
|
||||
void deleteAllBySubjectIdIn(@Param("subjectIds") Collection<String> subjectIds);
|
||||
|
||||
/**
|
||||
* 按客体 ID 删除所有
|
||||
*
|
||||
* @param objectIds {@link String}
|
||||
*/
|
||||
@Modifying
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Query(value = "UPDATE app_permission_policy SET " + SOFT_DELETE_SET
|
||||
+ " WHERE object_id IN (:objectIds)", nativeQuery = true)
|
||||
void deleteAllByObjectIdIn(@Param("objectIds") Collection<Long> objectIds);
|
||||
|
||||
/**
|
||||
* 根据主体删除所有
|
||||
*
|
||||
* @param objectId
|
||||
*/
|
||||
@Modifying
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Query(value = "UPDATE app_permission_policy SET " + SOFT_DELETE_SET
|
||||
+ " WHERE object_id = :objectId", nativeQuery = true)
|
||||
void deleteAllByObjectId(@Param("objectId") Long objectId);
|
||||
|
||||
/**
|
||||
* 更新启用/禁用
|
||||
*
|
||||
* @param id {@link Serializable}
|
||||
* @param status {@link Boolean}
|
||||
* @return {@link Integer}
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Modifying
|
||||
@Query(value = "UPDATE PermissionResourceEntity set enabled =:status WHERE id =:id")
|
||||
Integer updateStatus(@Param(value = "id") Long id, @Param(value = "status") Boolean status);
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* eiam-common - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.repository.permission;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import cn.topiam.employee.common.entity.app.query.AppPolicyQuery;
|
||||
|
||||
/**
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2021/11/4 22:44
|
||||
*/
|
||||
public interface AppPermissionPolicyRepositoryCustomized {
|
||||
/**
|
||||
* 分页查询权限策略
|
||||
*
|
||||
* @param query {@link AppPolicyQuery}
|
||||
* @param request {@link Pageable}
|
||||
* @return {@link PermissionPolicyPO}
|
||||
*/
|
||||
Page<PermissionPolicyPO> findPage(AppPolicyQuery query, Pageable request);
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
* eiam-common - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.repository.permission;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.PermissionResourceEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import cn.topiam.employee.support.repository.LogicDeleteRepository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 资源权限 Repository 接口 SystemRepositoryCustomized
|
||||
* </p>
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020-08-10
|
||||
*/
|
||||
@Repository
|
||||
public interface AppPermissionResourceRepository extends
|
||||
LogicDeleteRepository<PermissionResourceEntity, Long>,
|
||||
QuerydslPredicateExecutor<PermissionResourceEntity> {
|
||||
|
||||
/**
|
||||
* findByIdContainsDeleted
|
||||
*
|
||||
* @param id must not be {@literal null}.
|
||||
* @return {@link PermissionResourceEntity}
|
||||
*/
|
||||
@NotNull
|
||||
@Query(value = "SELECT * FROM app_permission_resource WHERE id_ = :id", nativeQuery = true)
|
||||
Optional<PermissionResourceEntity> findByIdContainsDeleted(@NotNull @Param(value = "id") Long id);
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* eiam-common - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.common.repository.permission;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.PermissionRoleEntity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import cn.topiam.employee.support.repository.LogicDeleteRepository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表 Repository 接口
|
||||
* </p>
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020-08-10
|
||||
*/
|
||||
@Repository
|
||||
public interface AppPermissionRoleRepository extends
|
||||
LogicDeleteRepository<PermissionRoleEntity, Long>,
|
||||
QuerydslPredicateExecutor<PermissionRoleEntity> {
|
||||
/**
|
||||
* 更新角色状态
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @param enabled {@link String}
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Modifying
|
||||
@Query(value = "update app_permission_role set is_enabled = ?2 where id_ = ?1", nativeQuery = true)
|
||||
void updateStatus(@Param(value = "id") String id, @Param(value = "enabled") Boolean enabled);
|
||||
|
||||
/**
|
||||
* findByIdContainsDeleted
|
||||
*
|
||||
* @param id must not be {@literal null}.
|
||||
* @return {@link PermissionRoleEntity}
|
||||
*/
|
||||
@NotNull
|
||||
@Cacheable
|
||||
@Query(value = "SELECT * FROM app_permission_role WHERE id_ = :id", nativeQuery = true)
|
||||
Optional<PermissionRoleEntity> findByIdContainsDeleted(@NotNull @Param(value = "id") Long id);
|
||||
}
|
|
@ -82,143 +82,7 @@
|
|||
<constraints nullable="true"/>
|
||||
</column>
|
||||
</createTable>
|
||||
<createTable remarks="应用权限资源" tableName="app_permission_resource">
|
||||
<column name="id_" remarks="主键ID" type="BIGINT">
|
||||
<constraints nullable="false" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="name_" remarks="资源名称" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="code_" remarks="资源编码" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="desc_" remarks="资源描述" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="app_id" remarks="所属应用" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="is_enabled" remarks="是否启用" type="TINYINT(1)"/>
|
||||
<column name="create_by" remarks="创建者" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column defaultValueComputed="CURRENT_TIMESTAMP" name="create_time" remarks="创建时间" type="datetime">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="update_by" remarks="修改者" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column defaultValueComputed="CURRENT_TIMESTAMP" name="update_time" remarks="修改时间" type="datetime">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="remark_" remarks="备注" type="TEXT"/>
|
||||
<column name="is_deleted" remarks="删除标记" type="TINYINT(1)" defaultValueNumeric="0">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
</createTable>
|
||||
<createTable remarks="应用权限角色表" tableName="app_permission_role">
|
||||
<column name="id_" remarks="主键ID" type="BIGINT">
|
||||
<constraints nullable="false" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="name_" remarks="角色名称" type="VARCHAR(100)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="code_" remarks="角色编码" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="app_id" remarks="所属应用" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="is_enabled" remarks="是否启用" type="TINYINT(1)"/>
|
||||
<column name="create_by" remarks="创建者" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column defaultValueComputed="CURRENT_TIMESTAMP" name="create_time" remarks="创建时间" type="datetime">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="update_by" remarks="修改者" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column defaultValueComputed="CURRENT_TIMESTAMP" name="update_time" remarks="修改时间" type="datetime">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="remark_" remarks="备注" type="TEXT"/>
|
||||
<column name="is_deleted" remarks="删除标记" type="TINYINT(1)" defaultValueNumeric="0">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
</createTable>
|
||||
<createTable remarks="应用权限项" tableName="app_permission_action">
|
||||
<column name="id_" remarks="主键ID" type="BIGINT">
|
||||
<constraints nullable="false" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="value_" remarks="操作编码" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="type_" remarks="权限类型" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="name_" remarks="权限描述" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="resource_id" remarks="所属资源" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="create_by" remarks="创建者" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column defaultValueComputed="CURRENT_TIMESTAMP" name="create_time" remarks="创建时间" type="datetime">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="update_by" remarks="修改者" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column defaultValueComputed="CURRENT_TIMESTAMP" name="update_time" remarks="修改时间" type="datetime">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="remark_" remarks="备注" type="TEXT"/>
|
||||
<column name="is_deleted" remarks="删除标记" type="TINYINT(1)" defaultValueNumeric="0">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
</createTable>
|
||||
<createTable remarks="应用权限策略" tableName="app_permission_policy">
|
||||
<column name="id_" type="BIGINT" remarks="主键ID">
|
||||
<constraints nullable="false" primaryKey="true"/>
|
||||
</column>
|
||||
<column name="app_id" remarks="所属应用" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="subject_id" remarks="权限主体ID(用户、角色、分组、组织机构)" type="VARCHAR2(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="subject_type" remarks="权限主体类型(用户、角色、分组、组织机构)" type="VARCHAR(20)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="object_id" remarks="权限客体ID(操作权限、角色)" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="object_type" remarks="权限客体类型(操作权限、角色)" type="BIGINT">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="effect_" remarks="效果(Allow(允许)、Deny(拒绝))" type="VARCHAR(10)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="create_by" remarks="创建者" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column defaultValueComputed="CURRENT_TIMESTAMP" name="create_time" remarks="创建时间" type="datetime">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="update_by" remarks="修改者" type="VARCHAR(64)">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column defaultValueComputed="CURRENT_TIMESTAMP" name="update_time" remarks="修改时间" type="datetime">
|
||||
<constraints nullable="false"/>
|
||||
</column>
|
||||
<column name="remark_" remarks="备注" type="TEXT"/>
|
||||
<column name="is_deleted" remarks="删除标记" type="TINYINT(1)" defaultValueNumeric="0">
|
||||
<constraints nullable="true"/>
|
||||
</column>
|
||||
</createTable>
|
||||
<!--创建索引-->
|
||||
<createIndex tableName="app_group_association" indexName="uk_app_group_association" unique="true">
|
||||
<column name="group_id"/>
|
||||
<column name="app_id"/>
|
||||
|
|
|
@ -47,19 +47,19 @@
|
|||
"@ant-design/charts": "^1.4.2",
|
||||
"@ant-design/icons": "^5.2.6",
|
||||
"@ant-design/maps": "^1.0.7",
|
||||
"@ant-design/pro-components": "^2.6.19",
|
||||
"@ant-design/pro-components": "^2.6.23",
|
||||
"ahooks": "^3.7.8",
|
||||
"antd": "^5.9.1",
|
||||
"antd": "^5.9.2",
|
||||
"antd-img-crop": "^4.13.0",
|
||||
"antd-style": "^3.4.6",
|
||||
"antd-style": "^3.5.0",
|
||||
"classnames": "^2.3.2",
|
||||
"codemirror": "^5.65.5",
|
||||
"content-security-policy-parser": "^0.4.1",
|
||||
"crypto-js": "^4.1.1",
|
||||
"dayjs": "^1.11.9",
|
||||
"dayjs": "^1.11.10",
|
||||
"echarts": "^5.4.3",
|
||||
"fetch-jsonp": "^1.3.0",
|
||||
"form-render": "^2.2.14",
|
||||
"form-render": "^2.2.16",
|
||||
"google-libphonenumber": "^3.2.33",
|
||||
"js-base64": "^3.7.5",
|
||||
"js-yaml": "^4.1.0",
|
||||
|
@ -70,14 +70,14 @@
|
|||
"omit.js": "^2.0.2",
|
||||
"qs": "^6.11.2",
|
||||
"query-string": "^8.1.0",
|
||||
"rc-field-form": "^1.38.0",
|
||||
"rc-field-form": "^1.38.2",
|
||||
"rc-menu": "^9.12.0",
|
||||
"rc-select": "^14.8.1",
|
||||
"rc-tree": "^5.7.10",
|
||||
"rc-select": "^14.9.0",
|
||||
"rc-tree": "^5.7.12",
|
||||
"react": "^18.2.0",
|
||||
"react-codemirror2": "^7.2.1",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-fast-marquee": "^1.6.0",
|
||||
"react-fast-marquee": "^1.6.1",
|
||||
"react-helmet-async": "^1.3.0",
|
||||
"react-sortable-hoc": "^2.0.0",
|
||||
"yaml": "^2.3.2"
|
||||
|
@ -86,20 +86,20 @@
|
|||
"@ant-design/antd-theme-variable": "^1.0.0",
|
||||
"@types/classnames": "^2.3.1",
|
||||
"@types/crypto-js": "^4.1.2",
|
||||
"@types/google-libphonenumber": "^7.4.26",
|
||||
"@types/google-libphonenumber": "^7.4.27",
|
||||
"@types/history": "^4.7.11",
|
||||
"@types/js-yaml": "^4.0.6",
|
||||
"@types/lodash": "^4.14.198",
|
||||
"@types/numeral": "^2.0.2",
|
||||
"@types/lodash": "^4.14.199",
|
||||
"@types/numeral": "^2.0.3",
|
||||
"@types/qs": "^6.9.8",
|
||||
"@types/react": "^18.2.21",
|
||||
"@types/react": "^18.2.22",
|
||||
"@types/react-dom": "^18.2.7",
|
||||
"@types/react-helmet": "^6.1.6",
|
||||
"@umijs/lint": "^4.0.81",
|
||||
"@umijs/max": "^4.0.81",
|
||||
"cross-env": "^7.0.3",
|
||||
"cross-port-killer": "^1.4.0",
|
||||
"eslint": "^8.49.0",
|
||||
"eslint": "^8.50.0",
|
||||
"husky": "^8.0.3",
|
||||
"lint-staged": "^14.0.1",
|
||||
"prettier": "^3.0.3",
|
||||
|
|
|
@ -141,6 +141,22 @@ export default (props: {
|
|||
}}
|
||||
fieldProps={{ autoComplete: 'off' }}
|
||||
/>
|
||||
<ProFormText
|
||||
label={intl.formatMessage({
|
||||
id: 'pages.app.config.detail.items.login_access.protocol_config.jwt.config_about.idp_slo_endpoint',
|
||||
})}
|
||||
name={'idpSloEndpoint'}
|
||||
extra={intl.formatMessage({
|
||||
id: 'pages.app.config.detail.items.login_access.protocol_config.jwt.config_about.idp_slo_endpoint.extra',
|
||||
})}
|
||||
readonly
|
||||
proFieldProps={{
|
||||
render: (value: string) => {
|
||||
return value && <Typography.Text copyable>{value}</Typography.Text>;
|
||||
},
|
||||
}}
|
||||
fieldProps={{ autoComplete: 'off' }}
|
||||
/>
|
||||
<ProFormTextArea
|
||||
label={intl.formatMessage({
|
||||
id: 'pages.app.config.detail.items.login_access.protocol_config.jwt.config_about.idp_encrypt_cert',
|
||||
|
|
|
@ -160,7 +160,7 @@ export default {
|
|||
'pages.app.config.detail.items.login_access.protocol_config.jwt.config_about.idp_sso_endpoint.extra':
|
||||
'应用发起单点登录的地址。',
|
||||
'pages.app.config.detail.items.login_access.protocol_config.jwt.config_about.idp_slo_endpoint':
|
||||
'登出端点',
|
||||
'IdP SLO 地址',
|
||||
'pages.app.config.detail.items.login_access.protocol_config.jwt.config_about.idp_slo_endpoint.extra':
|
||||
'应用发起单点登出的地址。',
|
||||
'pages.app.config.detail.items.login_access.protocol_config.jwt.config_about.idp_encrypt_cert':
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import Role from './Role';
|
||||
|
||||
export default () => {
|
||||
return <Role />;
|
||||
};
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.controller.permission;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionActionListResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import cn.topiam.employee.console.pojo.query.permission.PermissionActionListQuery;
|
||||
import cn.topiam.employee.console.service.permission.PermissionActionService;
|
||||
import cn.topiam.employee.support.result.ApiRestResult;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import static cn.topiam.employee.common.constant.PermissionConstants.PERMISSION_PATH;
|
||||
|
||||
/**
|
||||
* 应用权限-权限
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 20:28
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Validated
|
||||
@Tag(name = "应用权限-权限项")
|
||||
@RequestMapping(value = PERMISSION_PATH
|
||||
+ "/action", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RestController
|
||||
public class PermissionActionController {
|
||||
|
||||
/**
|
||||
* logger
|
||||
*/
|
||||
private final Logger logger = LoggerFactory.getLogger(PermissionActionController.class);
|
||||
|
||||
/**
|
||||
* 获取所有权限
|
||||
*
|
||||
* @return {@link PermissionActionListResult}
|
||||
*/
|
||||
@Operation(summary = "获取权限项列表")
|
||||
@GetMapping(value = "/list")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<List<PermissionActionListResult>> getPermissionActionList(@Validated PermissionActionListQuery query) {
|
||||
List<PermissionActionListResult> list = permissionActionService
|
||||
.getPermissionActionList(query);
|
||||
return ApiRestResult.<List<PermissionActionListResult>> builder().result(list).build();
|
||||
}
|
||||
|
||||
private final PermissionActionService permissionActionService;
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.controller.permission;
|
||||
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyListResult;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionRoleListResult;
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionPolicyUpdateParam;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.topiam.employee.common.entity.app.query.AppPolicyQuery;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyGetResult;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionPolicyCreateParam;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionRoleCreateParam;
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionRoleUpdateParam;
|
||||
import cn.topiam.employee.console.service.permission.PermissionPolicyService;
|
||||
import cn.topiam.employee.support.lock.Lock;
|
||||
import cn.topiam.employee.support.preview.Preview;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
import cn.topiam.employee.support.result.ApiRestResult;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
||||
import static cn.topiam.employee.common.constant.PermissionConstants.PERMISSION_PATH;
|
||||
|
||||
/**
|
||||
* 应用权限
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2022/7/12 22:30
|
||||
*/
|
||||
@Validated
|
||||
@Tag(name = "应用权限-授权策略")
|
||||
@RequestMapping(value = PERMISSION_PATH
|
||||
+ "/policy", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class PermissionPolicyController {
|
||||
|
||||
/**
|
||||
* 获取所有策略(分页)
|
||||
*
|
||||
* @param page {@link PageModel}
|
||||
* @return {@link PermissionRoleListResult}
|
||||
*/
|
||||
@Operation(summary = "获取策略列表")
|
||||
@GetMapping(value = "/list")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Page<PermissionPolicyListResult>> getPermissionPolicyList(PageModel page,
|
||||
@Validated AppPolicyQuery query) {
|
||||
Page<PermissionPolicyListResult> result = permissionPolicyService
|
||||
.getPermissionPolicyList(page, query);
|
||||
return ApiRestResult.<Page<PermissionPolicyListResult>> builder().result(result).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建资源
|
||||
*
|
||||
* @param param {@link PermissionRoleCreateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "创建资源")
|
||||
@PostMapping(value = "/create")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> createPolicy(@Validated @RequestBody PermissionPolicyCreateParam param) {
|
||||
return ApiRestResult.<Boolean> builder()
|
||||
.result(permissionPolicyService.createPermissionPolicy(param)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资源
|
||||
*
|
||||
* @param param {@link PermissionRoleUpdateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "修改资源")
|
||||
@PutMapping(value = "/update/{id}")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> updatePolicy(@Validated PermissionPolicyUpdateParam param) {
|
||||
return ApiRestResult.<Boolean> builder()
|
||||
.result(permissionPolicyService.updatePermissionPolicy(param)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资源
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "删除资源")
|
||||
@DeleteMapping(value = "/delete/{id}")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> deletePermissionPolicy(@PathVariable(value = "id") String id) {
|
||||
return ApiRestResult.<Boolean> builder()
|
||||
.result(permissionPolicyService.deletePermissionPolicy(id)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资源
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "获取资源信息")
|
||||
@GetMapping(value = "/{id}")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<PermissionPolicyGetResult> getPermissionPolicy(@PathVariable(value = "id") String id) {
|
||||
//返回
|
||||
return ApiRestResult.<PermissionPolicyGetResult> builder()
|
||||
.result(permissionPolicyService.getPermissionPolicy(id)).build();
|
||||
}
|
||||
|
||||
private final PermissionPolicyService permissionPolicyService;
|
||||
}
|
|
@ -1,206 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.controller.permission;
|
||||
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionResourceGetResult;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionResourceListResult;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionRoleCreateParam;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.topiam.employee.audit.annotation.Audit;
|
||||
import cn.topiam.employee.audit.event.type.EventType;
|
||||
import cn.topiam.employee.common.enums.CheckValidityType;
|
||||
import cn.topiam.employee.console.pojo.query.permission.PermissionResourceListQuery;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionRoleListResult;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionResourceCreateParam;
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionResourceUpdateParam;
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionRoleUpdateParam;
|
||||
import cn.topiam.employee.console.service.permission.PermissionResourceService;
|
||||
import cn.topiam.employee.support.lock.Lock;
|
||||
import cn.topiam.employee.support.preview.Preview;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
import cn.topiam.employee.support.result.ApiRestResult;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import static cn.topiam.employee.common.constant.PermissionConstants.PERMISSION_PATH;
|
||||
|
||||
/**
|
||||
* 应用权限
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2022/7/12 22:30
|
||||
*/
|
||||
@Validated
|
||||
@Tag(name = "应用权限-资源")
|
||||
@RequestMapping(value = PERMISSION_PATH
|
||||
+ "/resource", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
public class PermissionResourceController {
|
||||
|
||||
/**
|
||||
* 获取所有资源(分页)
|
||||
*
|
||||
* @param page {@link PageModel}
|
||||
* @return {@link PermissionRoleListResult}
|
||||
*/
|
||||
@Operation(summary = "获取资源列表")
|
||||
@GetMapping(value = "/list")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Page<PermissionResourceListResult>> getPermissionResourceList(PageModel page,
|
||||
@Validated PermissionResourceListQuery query) {
|
||||
Page<PermissionResourceListResult> result = permissionResourceService
|
||||
.getPermissionResourceList(page, query);
|
||||
return ApiRestResult.<Page<PermissionResourceListResult>> builder().result(result)
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建资源
|
||||
*
|
||||
* @param param {@link PermissionRoleCreateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "创建资源")
|
||||
@Audit(type = EventType.SAVE_APP_PERMISSION_RESOURCE)
|
||||
@PostMapping(value = "/create")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> createResource(@Validated @RequestBody PermissionResourceCreateParam param) {
|
||||
return ApiRestResult.<Boolean> builder()
|
||||
.result(permissionResourceService.createPermissionResource(param)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改资源
|
||||
*
|
||||
* @param param {@link PermissionRoleUpdateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "修改资源")
|
||||
@Audit(type = EventType.UPDATE_APP_PERMISSION_RESOURCE)
|
||||
@PutMapping(value = "/update")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> updateResource(@RequestBody @Validated PermissionResourceUpdateParam param) {
|
||||
return ApiRestResult.<Boolean> builder()
|
||||
.result(permissionResourceService.updatePermissionResource(param)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资源
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "删除资源")
|
||||
@Audit(type = EventType.DELETE_APP_PERMISSION_RESOURCE)
|
||||
@DeleteMapping(value = "/delete/{id}")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> deletePermissionResource(@PathVariable(value = "id") String id) {
|
||||
return ApiRestResult.<Boolean> builder()
|
||||
.result(permissionResourceService.deletePermissionResource(id)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资源
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Operation(summary = "获取资源信息")
|
||||
@GetMapping(value = "/get/{id}")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<PermissionResourceGetResult> getPermissionResource(@PathVariable(value = "id") String id) {
|
||||
//返回
|
||||
return ApiRestResult.<PermissionResourceGetResult> builder()
|
||||
.result(permissionResourceService.getPermissionResource(id)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用资源
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "启用资源")
|
||||
@Audit(type = EventType.ENABLE_APP_PERMISSION_RESOURCE)
|
||||
@PutMapping(value = "/enable/{id}")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> enableOrganization(@PathVariable(value = "id") Long id) {
|
||||
return ApiRestResult.<Boolean> builder()
|
||||
.result(permissionResourceService.updateStatus(id, Boolean.TRUE)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用资源
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "禁用资源")
|
||||
@Audit(type = EventType.DISABLE_APP_PERMISSION_RESOURCE)
|
||||
@PutMapping(value = "/disable/{id}")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> disableOrganization(@PathVariable(value = "id") Long id) {
|
||||
return ApiRestResult.<Boolean> builder()
|
||||
.result(permissionResourceService.updateStatus(id, Boolean.FALSE)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数有效性验证
|
||||
*
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Operation(summary = "参数有效性验证")
|
||||
@GetMapping(value = "/param_check")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> resourceParamCheck(@Parameter(description = "验证类型") @NotNull(message = "验证类型不能为空") CheckValidityType type,
|
||||
@Parameter(description = "值") @NotEmpty(message = "验证值不能为空") String value,
|
||||
@Parameter(description = "应用ID") @NotNull(message = "应用ID不能为空") Long appId,
|
||||
@Parameter(description = "ID") Long id) {
|
||||
Boolean result = permissionResourceService.permissionResourceParamCheck(type, value,
|
||||
appId, id);
|
||||
//返回
|
||||
return ApiRestResult.<Boolean> builder().result(result).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源服务类
|
||||
*/
|
||||
private final PermissionResourceService permissionResourceService;
|
||||
}
|
|
@ -1,198 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.controller.permission;
|
||||
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionRoleListResult;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionRoleResult;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionRoleCreateParam;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.topiam.employee.audit.annotation.Audit;
|
||||
import cn.topiam.employee.audit.event.type.EventType;
|
||||
import cn.topiam.employee.common.enums.CheckValidityType;
|
||||
import cn.topiam.employee.console.pojo.query.permission.PermissionRoleListQuery;
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionRoleUpdateParam;
|
||||
import cn.topiam.employee.console.service.permission.PermissionRoleService;
|
||||
import cn.topiam.employee.support.lock.Lock;
|
||||
import cn.topiam.employee.support.preview.Preview;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
import cn.topiam.employee.support.result.ApiRestResult;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import static cn.topiam.employee.common.constant.PermissionConstants.PERMISSION_PATH;
|
||||
|
||||
/**
|
||||
* 应用角色
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 20:28
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Validated
|
||||
@Tag(name = "应用权限-角色")
|
||||
@RequestMapping(value = PERMISSION_PATH + "/role", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@RestController
|
||||
public class PermissionRoleController {
|
||||
|
||||
/**
|
||||
* 获取所有角色(分页)
|
||||
*
|
||||
* @param page {@link PageModel}
|
||||
* @return {@link PermissionRoleListResult}
|
||||
*/
|
||||
@Operation(summary = "获取角色列表")
|
||||
@GetMapping(value = "/list")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Page<PermissionRoleListResult>> getPermissionRoleList(PageModel page,
|
||||
@Validated PermissionRoleListQuery query) {
|
||||
Page<PermissionRoleListResult> result = permissionRoleService
|
||||
.getPermissionRoleList(page, query);
|
||||
return ApiRestResult.<Page<PermissionRoleListResult>> builder().result(result).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建角色
|
||||
*
|
||||
* @param param {@link PermissionRoleCreateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "创建角色")
|
||||
@Audit(type = EventType.SAVE_APP_PERMISSION_ROLE)
|
||||
@PostMapping(value = "/create")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> createPermissionRole(@Validated @RequestBody PermissionRoleCreateParam param) {
|
||||
return ApiRestResult.<Boolean> builder()
|
||||
.result(permissionRoleService.createPermissionRole(param)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改角色
|
||||
*
|
||||
* @param param {@link PermissionRoleUpdateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "修改角色")
|
||||
@Audit(type = EventType.UPDATE_APP_PERMISSION_ROLE)
|
||||
@PutMapping(value = "/update")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> updatePermissionRole(@RequestBody @Validated PermissionRoleUpdateParam param) {
|
||||
return ApiRestResult.<Boolean> builder()
|
||||
.result(permissionRoleService.updatePermissionRole(param)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*
|
||||
* @param ids {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "删除角色")
|
||||
@Audit(type = EventType.DELETE_APP_PERMISSION_ROLE)
|
||||
@DeleteMapping(value = "/delete/{ids}")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> deletePermissionRole(@PathVariable(value = "ids") String ids) {
|
||||
return ApiRestResult.<Boolean> builder()
|
||||
.result(permissionRoleService.deletePermissionRole(ids)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Operation(summary = "获取角色信息")
|
||||
@GetMapping(value = "/{id}")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<PermissionRoleResult> getPermissionRole(@PathVariable(value = "id") Long id) {
|
||||
PermissionRoleResult details = permissionRoleService.getPermissionRole(id);
|
||||
//返回
|
||||
return ApiRestResult.<PermissionRoleResult> builder().result(details).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用角色
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "启用角色")
|
||||
@PutMapping(value = "/enable/{id}")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> enablePermissionRole(@PathVariable(value = "id") String id) {
|
||||
Boolean result = permissionRoleService.updatePermissionRoleStatus(id, Boolean.TRUE);
|
||||
return ApiRestResult.<Boolean> builder().result(result).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用角色
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Lock
|
||||
@Preview
|
||||
@Operation(summary = "禁用角色")
|
||||
@PutMapping(value = "/disable/{id}")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> disablePermissionRole(@PathVariable(value = "id") String id) {
|
||||
Boolean result = permissionRoleService.updatePermissionRoleStatus(id, Boolean.FALSE);
|
||||
return ApiRestResult.<Boolean> builder().result(result).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数有效性验证
|
||||
*
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Operation(summary = "参数有效性验证")
|
||||
@GetMapping(value = "/param_check")
|
||||
@PreAuthorize(value = "authenticated and @sae.hasAuthority(T(cn.topiam.employee.support.security.userdetails.UserType).ADMIN)")
|
||||
public ApiRestResult<Boolean> permissionRoleParamCheck(@Parameter(description = "验证类型") @NotNull(message = "验证类型不能为空") CheckValidityType type,
|
||||
@Parameter(description = "值") @NotEmpty(message = "验证值不能为空") String value,
|
||||
@Parameter(description = "应用ID") @NotNull(message = "应用ID不能为空") Long appId,
|
||||
@Parameter(description = "ID") Long id) {
|
||||
Boolean result = permissionRoleService.permissionRoleParamCheck(type, value, appId, id);
|
||||
//返回
|
||||
return ApiRestResult.<Boolean> builder().result(result).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色服务类
|
||||
*/
|
||||
private final PermissionRoleService permissionRoleService;
|
||||
}
|
|
@ -28,8 +28,8 @@ import cn.topiam.employee.audit.event.type.EventType;
|
|||
import cn.topiam.employee.common.enums.MailType;
|
||||
import cn.topiam.employee.common.enums.MessageCategory;
|
||||
import cn.topiam.employee.common.enums.SmsType;
|
||||
import cn.topiam.employee.console.pojo.save.setting.SmsProviderSaveParam;
|
||||
import cn.topiam.employee.console.pojo.result.setting.SmsProviderConfigResult;
|
||||
import cn.topiam.employee.console.pojo.save.setting.SmsProviderSaveParam;
|
||||
import cn.topiam.employee.console.service.setting.MessageSettingService;
|
||||
import cn.topiam.employee.core.message.MsgVariable;
|
||||
import cn.topiam.employee.core.message.sms.SmsMsgEventPublish;
|
||||
|
|
|
@ -89,6 +89,7 @@ public interface AppGroupConverter {
|
|||
* @param param {@link AppGroupUpdateParam}
|
||||
* @return {@link AppGroupEntity}
|
||||
*/
|
||||
@Mapping(target = "type", ignore = true)
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
|
@ -102,6 +103,7 @@ public interface AppGroupConverter {
|
|||
* @param param {@link AppAccountCreateParam}
|
||||
* @return {@link AppAccountEntity}
|
||||
*/
|
||||
@Mapping(target = "type", ignore = true)
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "id", ignore = true)
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
|
|
|
@ -1,126 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.converter.permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.PermissionActionEntity;
|
||||
import cn.topiam.employee.common.entity.permission.PermissionResourceEntity;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import com.querydsl.core.types.ExpressionUtils;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
|
||||
import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity;
|
||||
import cn.topiam.employee.common.enums.PermissionActionType;
|
||||
import cn.topiam.employee.console.pojo.query.permission.PermissionActionListQuery;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionActionListResult;
|
||||
|
||||
/**
|
||||
* 权限映射
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/14 22:45
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface PermissionActionConverter {
|
||||
/**
|
||||
* 应用权限资源列表转分页
|
||||
*
|
||||
* @param query {@link PermissionActionListQuery}
|
||||
* @return {@link Predicate}
|
||||
*/
|
||||
default Predicate appPermissionActionListQueryConvertToPredicate(PermissionActionListQuery query) {
|
||||
QAppPermissionResourceEntity resource = QAppPermissionResourceEntity.appPermissionResourceEntity;
|
||||
Predicate predicate = ExpressionUtils.and(resource.isNotNull(),
|
||||
resource.deleted.eq(Boolean.FALSE));
|
||||
//查询条件
|
||||
//@formatter:off
|
||||
// 资源名称
|
||||
predicate = StringUtils.isBlank(query.getName()) ? predicate : ExpressionUtils.and(predicate, resource.name.like("%" + query.getName() + "%"));
|
||||
// 资源ID
|
||||
predicate = ObjectUtils.isEmpty(query.getId()) ? predicate : ExpressionUtils.and(predicate, resource.id.eq(Long.valueOf(query.getId())));
|
||||
//应用ID
|
||||
predicate = ObjectUtils.isEmpty(query.getAppId()) ? predicate : ExpressionUtils.and(predicate, resource.appId.eq(Long.valueOf(query.getAppId())));
|
||||
//@formatter:on
|
||||
return predicate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实体转资源权限结果返回
|
||||
*
|
||||
* @param list {@link PermissionResourceEntity}
|
||||
* @return {@link PermissionActionListResult}
|
||||
*/
|
||||
default List<PermissionActionListResult> entityConvertToResourceActionListResult(List<PermissionResourceEntity> list) {
|
||||
List<PermissionActionListResult> results = new ArrayList<>();
|
||||
List<PermissionActionListResult.Action> menus = new ArrayList<>();
|
||||
List<PermissionActionListResult.Action> apis = new ArrayList<>();
|
||||
List<PermissionActionListResult.Action> buttons = new ArrayList<>();
|
||||
List<PermissionActionListResult.Action> others = new ArrayList<>();
|
||||
List<PermissionActionListResult.Action> datas = new ArrayList<>();
|
||||
for (PermissionResourceEntity resource : list) {
|
||||
for (PermissionActionEntity action : resource.getActions()) {
|
||||
if (PermissionActionType.MENU.equals(action.getType())) {
|
||||
menus.add(actionConvertToResourceActionResult(action));
|
||||
}
|
||||
if (PermissionActionType.API.equals(action.getType())) {
|
||||
apis.add(actionConvertToResourceActionResult(action));
|
||||
}
|
||||
if (PermissionActionType.DATA.equals(action.getType())) {
|
||||
datas.add(actionConvertToResourceActionResult(action));
|
||||
}
|
||||
if (PermissionActionType.BUTTON.equals(action.getType())) {
|
||||
buttons.add(actionConvertToResourceActionResult(action));
|
||||
}
|
||||
if (PermissionActionType.OTHER.equals(action.getType())) {
|
||||
others.add(actionConvertToResourceActionResult(action));
|
||||
}
|
||||
}
|
||||
PermissionActionListResult result = new PermissionActionListResult();
|
||||
//基本信息
|
||||
result.setAppId(resource.getAppId().toString());
|
||||
result.setId(resource.getId().toString());
|
||||
result.setName(resource.getName());
|
||||
result.setEnabled(resource.getEnabled());
|
||||
result.setDesc(resource.getDesc());
|
||||
//权限资源
|
||||
result.setButtons(buttons);
|
||||
result.setApis(apis);
|
||||
result.setDatas(datas);
|
||||
result.setMenus(menus);
|
||||
result.setOthers(others);
|
||||
results.add(result);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* actionConvertToResourceActionResult
|
||||
*
|
||||
* @param action {@link PermissionActionEntity}
|
||||
* @return {@link PermissionActionListResult.Action}
|
||||
*/
|
||||
@Mapping(target = "access", source = "value")
|
||||
PermissionActionListResult.Action actionConvertToResourceActionResult(PermissionActionEntity action);
|
||||
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.converter.permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.PermissionPolicyEntity;
|
||||
import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyListResult;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionPolicyCreateParam;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionPolicyUpdateParam;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
|
||||
/**
|
||||
* 策略映射
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/14 22:45
|
||||
*/
|
||||
@Mapper(componentModel = "spring", uses = PermissionActionConverter.class)
|
||||
public interface PermissionPolicyConverter {
|
||||
|
||||
/**
|
||||
* 资源创建参数转实体类
|
||||
*
|
||||
* @param param {@link PermissionPolicyCreateParam}
|
||||
* @return {@link PermissionPolicyEntity}
|
||||
*/
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "id", ignore = true)
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
@Mapping(target = "remark", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "createBy", ignore = true)
|
||||
PermissionPolicyEntity policyCreateParamConvertToEntity(PermissionPolicyCreateParam param);
|
||||
|
||||
/**
|
||||
* 资源修改参数转实体类
|
||||
*
|
||||
* @param param {@link PermissionPolicyCreateParam}
|
||||
* @return {@link PermissionPolicyEntity}
|
||||
*/
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
@Mapping(target = "remark", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "createBy", ignore = true)
|
||||
PermissionPolicyEntity policyUpdateParamConvertToEntity(PermissionPolicyUpdateParam param);
|
||||
|
||||
/**
|
||||
* 资源转换为资源列表结果
|
||||
*
|
||||
* @param page {@link Page}
|
||||
* @return {@link Page}
|
||||
*/
|
||||
default Page<PermissionPolicyListResult> entityConvertToPolicyListResult(org.springframework.data.domain.Page<PermissionPolicyPO> page) {
|
||||
Page<PermissionPolicyListResult> result = new Page<>();
|
||||
List<PermissionPolicyPO> pageList = page.getContent();
|
||||
if (!CollectionUtils.isEmpty(pageList)) {
|
||||
//@formatter:off
|
||||
result.setPagination(Page.Pagination.builder()
|
||||
.total(page.getTotalElements())
|
||||
.totalPages(page.getTotalPages())
|
||||
.current(page.getPageable().getPageNumber() + 1)
|
||||
.build());
|
||||
//@formatter:on
|
||||
List<PermissionPolicyListResult> list = new ArrayList<>();
|
||||
for (PermissionPolicyPO po : pageList) {
|
||||
list.add(entityConvertToPolicyListResult(po));
|
||||
}
|
||||
result.setList(list);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* entityConvertToPolicyListResult
|
||||
*
|
||||
* @param entity {@link PermissionPolicyListResult}
|
||||
* @return {@link PermissionPolicyPO}
|
||||
*/
|
||||
PermissionPolicyListResult entityConvertToPolicyListResult(PermissionPolicyPO entity);
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.converter.permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.PermissionResourceEntity;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionResourceGetResult;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionResourceListResult;
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionResourceUpdateParam;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import com.querydsl.core.types.ExpressionUtils;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
|
||||
import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity;
|
||||
import cn.topiam.employee.console.pojo.query.permission.PermissionResourceListQuery;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionResourceCreateParam;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
|
||||
/**
|
||||
* 资源映射
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/14 22:45
|
||||
*/
|
||||
@Mapper(componentModel = "spring", uses = PermissionActionConverter.class)
|
||||
public interface PermissionResourceConverter {
|
||||
|
||||
/**
|
||||
* 资源分页查询参数转实体
|
||||
*
|
||||
* @param query {@link PermissionResourceListQuery}
|
||||
* @return {@link Predicate}
|
||||
*/
|
||||
default Predicate resourcePaginationParamConvertToPredicate(PermissionResourceListQuery query) {
|
||||
QAppPermissionResourceEntity resource = QAppPermissionResourceEntity.appPermissionResourceEntity;
|
||||
Predicate predicate = ExpressionUtils.and(resource.isNotNull(),
|
||||
resource.deleted.eq(Boolean.FALSE));
|
||||
//查询条件
|
||||
//@formatter:off
|
||||
// 资源名称
|
||||
predicate = StringUtils.isBlank(query.getName()) ? predicate : ExpressionUtils.and(predicate, resource.name.like("%" + query.getName() + "%"));
|
||||
// 所属应用
|
||||
predicate = ObjectUtils.isEmpty(query.getAppId()) ? predicate : ExpressionUtils.and(predicate, resource.appId.eq(query.getAppId()));
|
||||
//@formatter:on
|
||||
return predicate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源创建参数转实体类
|
||||
*
|
||||
* @param param {@link PermissionResourceCreateParam}
|
||||
* @return {@link PermissionResourceEntity}
|
||||
*/
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "actions", ignore = true)
|
||||
@Mapping(target = "id", ignore = true)
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
@Mapping(target = "remark", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "createBy", ignore = true)
|
||||
PermissionResourceEntity resourceCreateParamConvertToEntity(PermissionResourceCreateParam param);
|
||||
|
||||
/**
|
||||
* 资源修改参数转实体类
|
||||
*
|
||||
* @param param {@link PermissionResourceCreateParam}
|
||||
* @return {@link PermissionResourceEntity}
|
||||
*/
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "actions", ignore = true)
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
@Mapping(target = "remark", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "createBy", ignore = true)
|
||||
PermissionResourceEntity resourceUpdateParamConvertToEntity(PermissionResourceUpdateParam param);
|
||||
|
||||
/**
|
||||
* 资源转换为资源列表结果
|
||||
*
|
||||
* @param page {@link Page}
|
||||
* @return {@link Page}
|
||||
*/
|
||||
default Page<PermissionResourceListResult> entityConvertToResourceListResult(org.springframework.data.domain.Page<PermissionResourceEntity> page) {
|
||||
Page<PermissionResourceListResult> result = new Page<>();
|
||||
List<PermissionResourceEntity> pageList = page.getContent();
|
||||
if (!CollectionUtils.isEmpty(pageList)) {
|
||||
List<PermissionResourceListResult> list = new ArrayList<>();
|
||||
for (PermissionResourceEntity resource : pageList) {
|
||||
list.add(entityConvertToResourceListResult(resource));
|
||||
}
|
||||
//@formatter:off
|
||||
result.setPagination(Page.Pagination.builder()
|
||||
.total(page.getTotalElements())
|
||||
.totalPages(page.getTotalPages())
|
||||
.current(page.getPageable().getPageNumber() + 1)
|
||||
.build());
|
||||
//@formatter:on
|
||||
result.setList(list);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实体转换为资源列表结果
|
||||
*
|
||||
* @param data {@link PermissionResourceEntity}
|
||||
* @return {@link PermissionResourceListResult}
|
||||
*/
|
||||
PermissionResourceListResult entityConvertToResourceListResult(PermissionResourceEntity data);
|
||||
|
||||
/**
|
||||
* 实体转获取详情返回
|
||||
*
|
||||
* @param resource {@link PermissionResourceEntity}
|
||||
* @return {@link PermissionResourceGetResult}
|
||||
*/
|
||||
@Mapping(target = "actions", source = "actions")
|
||||
PermissionResourceGetResult entityConvertToResourceGetResult(PermissionResourceEntity resource);
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.converter.permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionRoleCreateParam;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import com.querydsl.core.types.ExpressionUtils;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
|
||||
import cn.topiam.employee.common.entity.app.QAppPermissionRoleEntity;
|
||||
import cn.topiam.employee.common.entity.permission.PermissionRoleEntity;
|
||||
import cn.topiam.employee.console.pojo.query.permission.PermissionRoleListQuery;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionRoleListResult;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionRoleResult;
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionRoleUpdateParam;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
|
||||
/**
|
||||
* 角色映射
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/14 22:45
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface PermissionRoleConverter {
|
||||
|
||||
/**
|
||||
* 角色实体转换为角色分页结果
|
||||
*
|
||||
* @param page {@link Page}
|
||||
* @return {@link Page}
|
||||
*/
|
||||
default Page<PermissionRoleListResult> entityConvertToRolePaginationResult(org.springframework.data.domain.Page<PermissionRoleEntity> page) {
|
||||
Page<PermissionRoleListResult> result = new Page<>();
|
||||
if (!CollectionUtils.isEmpty(page.getContent())) {
|
||||
List<PermissionRoleListResult> list = new ArrayList<>();
|
||||
for (PermissionRoleEntity user : page.getContent()) {
|
||||
list.add(entityConvertToRolePaginationResult(user));
|
||||
}
|
||||
//@formatter:off
|
||||
result.setPagination(Page.Pagination.builder()
|
||||
.total(page.getTotalElements())
|
||||
.totalPages(page.getTotalPages())
|
||||
.current(page.getPageable().getPageNumber() + 1)
|
||||
.build());
|
||||
//@formatter:on
|
||||
result.setList(list);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色实体转换为角色分页结果
|
||||
*
|
||||
* @param page {@link PermissionRoleEntity}
|
||||
* @return {@link PermissionRoleListResult}
|
||||
*/
|
||||
PermissionRoleListResult entityConvertToRolePaginationResult(PermissionRoleEntity page);
|
||||
|
||||
/**
|
||||
* 角色创建参数转换为角色实体
|
||||
*
|
||||
* @param param {@link PermissionRoleCreateParam}
|
||||
* @return {@link PermissionRoleEntity}
|
||||
*/
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "id", ignore = true)
|
||||
@Mapping(target = "enabled", expression = "java(Boolean.TRUE)")
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "createBy", ignore = true)
|
||||
PermissionRoleEntity roleCreateParamConvertToEntity(PermissionRoleCreateParam param);
|
||||
|
||||
/**
|
||||
* 角色更新参数转换为角色实体类
|
||||
*
|
||||
* @param param {@link PermissionRoleUpdateParam} 更新参数
|
||||
* @return {@link PermissionRoleEntity} 角色实体
|
||||
*/
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "appId", ignore = true)
|
||||
@Mapping(target = "enabled", ignore = true)
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "createBy", ignore = true)
|
||||
PermissionRoleEntity roleUpdateParamConvertToEntity(PermissionRoleUpdateParam param);
|
||||
|
||||
/**
|
||||
* 实体转系统详情结果
|
||||
*
|
||||
* @param role {@link PermissionRoleEntity}
|
||||
* @return {@link PermissionRoleResult}
|
||||
*/
|
||||
PermissionRoleResult entityConvertToRoleDetailResult(PermissionRoleEntity role);
|
||||
|
||||
/**
|
||||
* 角色分页查询参数转实体
|
||||
*
|
||||
* @param query {@link PermissionRoleListQuery}
|
||||
* @return {@link PermissionRoleEntity}
|
||||
*/
|
||||
default Predicate rolePaginationParamConvertToPredicate(PermissionRoleListQuery query) {
|
||||
QAppPermissionRoleEntity role = QAppPermissionRoleEntity.appPermissionRoleEntity;
|
||||
Predicate predicate = ExpressionUtils.and(role.isNotNull(), role.deleted.eq(Boolean.FALSE));
|
||||
//查询条件
|
||||
//@formatter:off
|
||||
// 角色名称
|
||||
predicate = StringUtils.isBlank(query.getName()) ? predicate : ExpressionUtils.and(predicate, role.name.like("%" + query.getName() + "%"));
|
||||
// 是否启用
|
||||
predicate = ObjectUtils.isEmpty(query.getEnabled()) ? predicate : ExpressionUtils.and(predicate, role.enabled.eq(query.getEnabled()));
|
||||
// 角色编码
|
||||
predicate = StringUtils.isBlank(query.getCode()) ? predicate : ExpressionUtils.and(predicate, role.code.eq(query.getCode()));
|
||||
// 所属应用
|
||||
predicate = ObjectUtils.isEmpty(query.getAppId()) ? predicate : ExpressionUtils.and(predicate, role.appId.eq(query.getAppId()));
|
||||
//@formatter:on
|
||||
return predicate;
|
||||
}
|
||||
}
|
|
@ -40,9 +40,9 @@ import cn.topiam.employee.common.message.sms.aliyun.AliyunSmsProviderConfig;
|
|||
import cn.topiam.employee.common.message.sms.qiniu.QiNiuSmsProviderConfig;
|
||||
import cn.topiam.employee.common.message.sms.tencent.TencentSmsProviderConfig;
|
||||
import cn.topiam.employee.console.pojo.result.setting.EmailProviderConfigResult;
|
||||
import cn.topiam.employee.console.pojo.result.setting.SmsProviderConfigResult;
|
||||
import cn.topiam.employee.console.pojo.save.setting.MailProviderSaveParam;
|
||||
import cn.topiam.employee.console.pojo.save.setting.SmsProviderSaveParam;
|
||||
import cn.topiam.employee.console.pojo.result.setting.SmsProviderConfigResult;
|
||||
import cn.topiam.employee.support.exception.TopIamException;
|
||||
import cn.topiam.employee.support.validation.ValidationUtils;
|
||||
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.query.permission;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* 查询权限列表入参
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/11 23:08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "查询权限列表入参")
|
||||
@ParameterObject
|
||||
public class PermissionActionListQuery implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 4307939244290315206L;
|
||||
|
||||
/**
|
||||
* 资源ID
|
||||
*/
|
||||
@Parameter(description = "资源ID")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
@Parameter(description = "资源名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
@Parameter(description = "应用ID")
|
||||
@NotEmpty(message = "应用ID不能为空")
|
||||
private String appId;
|
||||
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.query.permission;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 分页查询资源入参
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/11 23:08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "查询权限资源列表入参")
|
||||
@ParameterObject
|
||||
public class PermissionResourceListQuery implements Serializable {
|
||||
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
@Parameter(description = "资源名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@NotNull(message = "请选择资源所属应用")
|
||||
@Parameter(description = "所属应用")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Parameter(description = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.query.permission;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 分页查询角色入参
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/11 23:08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "查询角色列表入参")
|
||||
@ParameterObject
|
||||
public class PermissionRoleListQuery implements Serializable {
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@Parameter(description = "角色名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
@Parameter(description = "角色编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@NotNull(message = "请选择角色所属应用")
|
||||
@Parameter(description = "所属应用")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Parameter(description = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.result.permission;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 获取应用资源权限列表
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/11 23:08
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "获取应用资源权限列表")
|
||||
public class PermissionActionListResult implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3320953184046791392L;
|
||||
/**
|
||||
* 资源ID
|
||||
*/
|
||||
@Parameter(description = "资源ID")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 资源编码
|
||||
*/
|
||||
@Parameter(description = "资源编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
@Parameter(description = "资源名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@Parameter(description = "所属应用")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* desc
|
||||
*/
|
||||
@Parameter(description = "描述")
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Parameter(description = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 路由权限
|
||||
*/
|
||||
@Parameter(description = "菜单权限")
|
||||
private List<Action> menus;
|
||||
|
||||
/**
|
||||
* 操作权限
|
||||
*/
|
||||
@Parameter(description = "操作权限")
|
||||
private List<Action> buttons;
|
||||
|
||||
/**
|
||||
* 接口权限
|
||||
*/
|
||||
@Parameter(description = "接口权限")
|
||||
private List<Action> apis;
|
||||
|
||||
/**
|
||||
* 操作权限
|
||||
*/
|
||||
@Parameter(description = "数据权限")
|
||||
private List<Action> datas;
|
||||
|
||||
/**
|
||||
* 其他权限
|
||||
*/
|
||||
@Parameter(description = "其他权限")
|
||||
private List<Action> others;
|
||||
|
||||
@Data
|
||||
@Schema(description = "权限项")
|
||||
public static class Action implements Serializable {
|
||||
|
||||
/**
|
||||
* 权限ID
|
||||
*/
|
||||
@Parameter(description = "权限ID")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
@Parameter(description = "权限名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 权限标识
|
||||
*/
|
||||
@Parameter(description = "权限标识")
|
||||
private String access;
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.result.permission;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyEffect;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyObjectType;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicySubjectType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 获取资源
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:45
|
||||
*/
|
||||
@Schema(description = "获取资源结果")
|
||||
@Data
|
||||
public class PermissionPolicyGetResult implements Serializable {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Parameter(description = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 授权主体id
|
||||
*/
|
||||
@Parameter(description = "授权主体id")
|
||||
private String subjectId;
|
||||
|
||||
/**
|
||||
* 授权主体名称
|
||||
*/
|
||||
@Parameter(description = "授权主体名称")
|
||||
private String subjectName;
|
||||
|
||||
/**
|
||||
* 权限主体类型(用户、角色、分组、组织机构)
|
||||
*/
|
||||
@Parameter(description = "授权主体类型")
|
||||
private AppPolicySubjectType subjectType;
|
||||
|
||||
/**
|
||||
* 权限客体ID
|
||||
*/
|
||||
@Parameter(description = "授权客体id")
|
||||
private Long objectId;
|
||||
|
||||
/**
|
||||
* 权限客体名菜
|
||||
*/
|
||||
@Parameter(description = "授权客体名称")
|
||||
private String objectName;
|
||||
|
||||
/**
|
||||
* 权限客体类型(权限、角色)
|
||||
*/
|
||||
@Parameter(description = "授权客体类型")
|
||||
private AppPolicyObjectType objectType;
|
||||
|
||||
/**
|
||||
* 授权作用
|
||||
*/
|
||||
@Parameter(description = "授权作用")
|
||||
private AppPolicyEffect effect;
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.result.permission;
|
||||
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyEffect;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyObjectType;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicySubjectType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2022/9/9 23:33
|
||||
*/
|
||||
@Schema(description = "获取授权列表")
|
||||
@Data
|
||||
public class PermissionPolicyListResult {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Parameter(description = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 授权主体id
|
||||
*/
|
||||
@Parameter(description = "授权主体id")
|
||||
private String subjectId;
|
||||
|
||||
/**
|
||||
* 授权主体名称
|
||||
*/
|
||||
@Parameter(description = "授权主体名称")
|
||||
private String subjectName;
|
||||
|
||||
/**
|
||||
* 权限主体类型(用户、角色、分组、组织机构)
|
||||
*/
|
||||
@Parameter(description = "授权主体类型")
|
||||
private AppPolicySubjectType subjectType;
|
||||
|
||||
/**
|
||||
* 权限客体ID
|
||||
*/
|
||||
@Parameter(description = "授权客体id")
|
||||
private Long objectId;
|
||||
|
||||
/**
|
||||
* 权限客体名菜
|
||||
*/
|
||||
@Parameter(description = "授权客体名称")
|
||||
private String objectName;
|
||||
|
||||
/**
|
||||
* 权限客体类型(权限、角色)
|
||||
*/
|
||||
@Parameter(description = "授权客体类型")
|
||||
private AppPolicyObjectType objectType;
|
||||
|
||||
/**
|
||||
* 授权作用
|
||||
*/
|
||||
@Parameter(description = "授权作用")
|
||||
private AppPolicyEffect effect;
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.result.permission;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.common.enums.PermissionActionType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 获取资源
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:45
|
||||
*/
|
||||
@Schema(description = "获取资源结果")
|
||||
@Data
|
||||
public class PermissionResourceGetResult implements Serializable {
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "资源名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@Schema(description = "资源编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "资源描述")
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@Schema(description = "所属应用")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 资源权限
|
||||
*/
|
||||
@Schema(description = "资源权限")
|
||||
private List<AppPermissionsAction> actions;
|
||||
|
||||
/**
|
||||
* AppPermissionsActionParam
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2022/9/1 00:18
|
||||
*/
|
||||
@Data
|
||||
public static class AppPermissionsAction implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -6391182747252245592L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Hidden
|
||||
@Schema(description = "ID")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
@Schema(description = "权限类型")
|
||||
private PermissionActionType type;
|
||||
|
||||
/**
|
||||
* 权限值
|
||||
*/
|
||||
@Schema(description = "权限值")
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 权限描述
|
||||
*/
|
||||
@Schema(description = "权限描述")
|
||||
private String name;
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.result.permission;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 资源分页查询结果
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/11 23:08
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "分页查询资源结果")
|
||||
public class PermissionResourceListResult implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3320953184046791392L;
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Parameter(description = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
@Parameter(description = "资源名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* code
|
||||
*/
|
||||
@Parameter(description = "资源编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@Parameter(description = "所属应用")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* desc
|
||||
*/
|
||||
@Parameter(description = "描述")
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Parameter(description = "是否启用")
|
||||
private Boolean enabled;
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.result.permission;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 角色分页查询结果
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/11 23:08
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "分页查询角色结果")
|
||||
public class PermissionRoleListResult implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3320953184046791392L;
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Parameter(description = "id")
|
||||
private String id;
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@Parameter(description = "角色名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
@Parameter(description = "角色编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@Parameter(description = "所属应用")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Parameter(description = "是否启用")
|
||||
private Boolean enabled;
|
||||
/**
|
||||
* remark
|
||||
*/
|
||||
@Parameter(description = "描述")
|
||||
private String remark;
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.result.permission;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 获取角色
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:45
|
||||
*/
|
||||
@Schema(description = "获取角色")
|
||||
@Data
|
||||
public class PermissionRoleResult implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Parameter(description = "id")
|
||||
private String id;
|
||||
/**
|
||||
* appId
|
||||
*/
|
||||
@Parameter(description = "应用ID")
|
||||
private String appId;
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@Parameter(description = "角色名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
@Parameter(description = "角色编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Parameter(description = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Parameter(description = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.save.permission;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyEffect;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyObjectType;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicySubjectType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 创建策略入参
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "创建策略入参")
|
||||
public class PermissionPolicyCreateParam implements Serializable {
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@NotNull(message = "资源所属应用不能为空")
|
||||
@Parameter(description = "所属应用")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 授权主体id
|
||||
*/
|
||||
@NotNull(message = "授权主体id不能为空")
|
||||
@Parameter(description = "授权主体id")
|
||||
private String subjectId;
|
||||
|
||||
/**
|
||||
* 权限主体类型(用户、角色、分组、组织机构)
|
||||
*/
|
||||
@NotNull(message = "授权主体类型不能为空")
|
||||
@Parameter(description = "授权主体类型")
|
||||
private AppPolicySubjectType subjectType;
|
||||
|
||||
/**
|
||||
* 权限客体ID
|
||||
*/
|
||||
@NotNull(message = "权限客体ID不能为空")
|
||||
@Parameter(description = "授权客体id")
|
||||
private Long objectId;
|
||||
|
||||
/**
|
||||
* 权限客体类型(权限、角色)
|
||||
*/
|
||||
@NotNull(message = "权限客体类型不能为空")
|
||||
@Parameter(description = "授权客体类型")
|
||||
private AppPolicyObjectType objectType;
|
||||
|
||||
/**
|
||||
* 授权作用
|
||||
*/
|
||||
@NotNull(message = "授权作用不能为空")
|
||||
@Parameter(description = "授权作用")
|
||||
private AppPolicyEffect effect;
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.save.permission;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 资源创建参数
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "创建资源入参")
|
||||
public class PermissionResourceCreateParam implements Serializable {
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@Schema(description = "资源编码")
|
||||
@NotBlank(message = "资源编码不能为空")
|
||||
private String code;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "资源名称")
|
||||
@NotBlank(message = "资源名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "资源描述")
|
||||
@NotBlank(message = "资源描述不能为空")
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean enabled = true;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@Schema(description = "所属应用")
|
||||
@NotNull(message = "所属应用不能为空")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 资源权限
|
||||
*/
|
||||
@Schema(description = "资源权限")
|
||||
// @NotNull(message = "资源权限不能为空")
|
||||
private List<PermissionsActionParam> actions;
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.save.permission;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 角色创建参数
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "创建角色入参")
|
||||
public class PermissionRoleCreateParam implements Serializable {
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
@NotBlank(message = "角色编码不能为空")
|
||||
private String code;
|
||||
/**
|
||||
* 启用
|
||||
*/
|
||||
private Boolean enabled = true;
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@NotNull(message = "所属应用不能为空")
|
||||
private Long appId;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.save.permission;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.topiam.employee.common.enums.PermissionActionType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* AppPermissionsActionParam
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2022/9/1 00:18
|
||||
*/
|
||||
@Data
|
||||
@Valid
|
||||
public class PermissionsActionParam implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -6391182747252245592L;
|
||||
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
@NotNull(message = "权限类型")
|
||||
private PermissionActionType type;
|
||||
/**
|
||||
* 权限值
|
||||
*/
|
||||
@NotEmpty(message = "权限值")
|
||||
private String value;
|
||||
/**
|
||||
* 权限描述
|
||||
*/
|
||||
@NotEmpty(message = "权限描述")
|
||||
private String name;
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.update.permission;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyEffect;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyObjectType;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicySubjectType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 修改策略入参
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "修改策略入参")
|
||||
public class PermissionPolicyUpdateParam implements Serializable {
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@NotNull(message = "资源所属应用不能为空")
|
||||
@Parameter(description = "所属应用")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 授权主体id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空")
|
||||
@Parameter(description = "主键id")
|
||||
private Long id;
|
||||
/**
|
||||
* 授权主体id
|
||||
*/
|
||||
@NotNull(message = "授权主体id不能为空")
|
||||
@Parameter(description = "授权主体id")
|
||||
private String subjectId;
|
||||
|
||||
/**
|
||||
* 权限主体类型(用户、角色、分组、组织机构)
|
||||
*/
|
||||
@NotNull(message = "授权主体类型不能为空")
|
||||
@Parameter(description = "授权主体类型")
|
||||
private AppPolicySubjectType subjectType;
|
||||
|
||||
/**
|
||||
* 权限客体ID
|
||||
*/
|
||||
@NotNull(message = "权限客体ID不能为空")
|
||||
@Parameter(description = "授权客体id")
|
||||
private Long objectId;
|
||||
|
||||
/**
|
||||
* 权限客体类型(权限、角色)
|
||||
*/
|
||||
@NotNull(message = "权限客体类型不能为空")
|
||||
@Parameter(description = "授权客体类型")
|
||||
private AppPolicyObjectType objectType;
|
||||
|
||||
/**
|
||||
* 授权作用
|
||||
*/
|
||||
@NotNull(message = "授权作用不能为空")
|
||||
@Parameter(description = "授权作用")
|
||||
private AppPolicyEffect effect;
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.update.permission;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionsActionParam;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.AccessMode.READ_ONLY;
|
||||
|
||||
/**
|
||||
* 资源修改参数
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "修改资源入参")
|
||||
public class PermissionResourceUpdateParam implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 6021548372386059064L;
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Schema(accessMode = READ_ONLY)
|
||||
@NotBlank(message = "ID不能为空")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "资源名称")
|
||||
@NotBlank(message = "资源名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@Schema(description = "资源编码")
|
||||
@NotBlank(message = "资源编码不能为空")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "资源描述")
|
||||
@NotBlank(message = "资源描述不能为空")
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@Schema(description = "所属应用")
|
||||
@NotNull(message = "所属应用不能为空")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Schema(description = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 资源权限
|
||||
*/
|
||||
@Schema(description = "资源权限")
|
||||
@NotNull(message = "资源权限不能为空")
|
||||
private List<PermissionsActionParam> actions;
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.pojo.update.permission;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.AccessMode.READ_ONLY;
|
||||
|
||||
/**
|
||||
* 角色修改参数
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "修改角色入参")
|
||||
public class PermissionRoleUpdateParam implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 6021548372386059064L;
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Schema(accessMode = READ_ONLY)
|
||||
@NotBlank(message = "ID不能为空")
|
||||
private String id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "角色名称")
|
||||
private String name;
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@Schema(description = "角色编码")
|
||||
private String code;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.service.permission;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.console.pojo.query.permission.PermissionActionListQuery;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionActionListResult;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 权限 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020-08-10
|
||||
*/
|
||||
public interface PermissionActionService {
|
||||
|
||||
/**
|
||||
* 获取资源权限列表
|
||||
*
|
||||
* @param query {@link PermissionActionListQuery}
|
||||
* @return {@link PermissionActionListResult}
|
||||
*/
|
||||
List<PermissionActionListResult> getPermissionActionList(PermissionActionListQuery query);
|
||||
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.service.permission;
|
||||
|
||||
import cn.topiam.employee.common.entity.app.query.AppPolicyQuery;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyGetResult;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyListResult;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionPolicyCreateParam;
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionPolicyUpdateParam;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 权限策略 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020-08-10
|
||||
*/
|
||||
public interface PermissionPolicyService {
|
||||
/**
|
||||
* 获取资源列表
|
||||
*
|
||||
* @param page {@link PageModel}
|
||||
* @param query {@link AppPolicyQuery}
|
||||
* @return {@link PermissionPolicyListResult}
|
||||
*/
|
||||
Page<PermissionPolicyListResult> getPermissionPolicyList(PageModel page,
|
||||
AppPolicyQuery query);
|
||||
|
||||
/**
|
||||
* 获取资源
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link PermissionPolicyGetResult}
|
||||
*/
|
||||
PermissionPolicyGetResult getPermissionPolicy(String id);
|
||||
|
||||
/**
|
||||
* 删除资源
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
Boolean deletePermissionPolicy(String id);
|
||||
|
||||
/**
|
||||
* 创建资源
|
||||
*
|
||||
* @param param {@link PermissionPolicyCreateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
Boolean createPermissionPolicy(PermissionPolicyCreateParam param);
|
||||
|
||||
/**
|
||||
* 更新资源
|
||||
*
|
||||
* @param param {@link PermissionPolicyUpdateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
Boolean updatePermissionPolicy(PermissionPolicyUpdateParam param);
|
||||
}
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.service.permission;
|
||||
|
||||
import cn.topiam.employee.common.enums.CheckValidityType;
|
||||
import cn.topiam.employee.console.pojo.query.permission.PermissionResourceListQuery;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionResourceGetResult;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionResourceListResult;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionResourceCreateParam;
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionResourceUpdateParam;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 资源权限 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020-08-10
|
||||
*/
|
||||
public interface PermissionResourceService {
|
||||
/**
|
||||
* 获取资源列表
|
||||
*
|
||||
* @param page {@link PageModel}
|
||||
* @param query {@link PermissionResourceListQuery}
|
||||
* @return {@link PermissionResourceListResult}
|
||||
*/
|
||||
Page<PermissionResourceListResult> getPermissionResourceList(PageModel page,
|
||||
PermissionResourceListQuery query);
|
||||
|
||||
/**
|
||||
* 获取资源
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link PermissionResourceGetResult}
|
||||
*/
|
||||
PermissionResourceGetResult getPermissionResource(String id);
|
||||
|
||||
/**
|
||||
* 删除资源
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
Boolean deletePermissionResource(String id);
|
||||
|
||||
/**
|
||||
* 启用/禁用
|
||||
*
|
||||
* @param id {@link Long}
|
||||
* @param enabled {@link Boolean}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
Boolean updateStatus(Long id, boolean enabled);
|
||||
|
||||
/**
|
||||
* 创建资源
|
||||
*
|
||||
* @param param {@link PermissionResourceCreateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
Boolean createPermissionResource(PermissionResourceCreateParam param);
|
||||
|
||||
/**
|
||||
* 更新资源
|
||||
*
|
||||
* @param param {@link PermissionResourceUpdateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
Boolean updatePermissionResource(PermissionResourceUpdateParam param);
|
||||
|
||||
/**
|
||||
* 参数有效性验证
|
||||
*
|
||||
* @param type {@link CheckValidityType}
|
||||
* @param value {@link String}
|
||||
* @param appId {@link Long}
|
||||
* @param id {@link Long}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
Boolean permissionResourceParamCheck(CheckValidityType type, String value, Long appId, Long id);
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.service.permission;
|
||||
|
||||
import cn.topiam.employee.common.enums.CheckValidityType;
|
||||
import cn.topiam.employee.console.pojo.query.permission.PermissionRoleListQuery;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionRoleListResult;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionRoleResult;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionRoleCreateParam;
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionRoleUpdateParam;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020-08-10
|
||||
*/
|
||||
public interface PermissionRoleService {
|
||||
|
||||
/**
|
||||
* 获取所有角色(分页)
|
||||
*
|
||||
* @param page {@link PageModel}
|
||||
* @param query {@link PermissionRoleListQuery}
|
||||
* @return {@link PermissionRoleListResult}
|
||||
*/
|
||||
Page<PermissionRoleListResult> getPermissionRoleList(PageModel page,
|
||||
PermissionRoleListQuery query);
|
||||
|
||||
/**
|
||||
* 创建角色
|
||||
*
|
||||
* @param param {@link PermissionRoleCreateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
boolean createPermissionRole(PermissionRoleCreateParam param);
|
||||
|
||||
/**
|
||||
* 更新角色
|
||||
*
|
||||
* @param param {@link PermissionRoleUpdateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
boolean updatePermissionRole(PermissionRoleUpdateParam param);
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*
|
||||
* @param ids {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
boolean deletePermissionRole(String ids);
|
||||
|
||||
/**
|
||||
* 角色详情
|
||||
*
|
||||
* @param id {@link Long}
|
||||
* @return {@link PermissionRoleResult}
|
||||
*/
|
||||
PermissionRoleResult getPermissionRole(Long id);
|
||||
|
||||
/**
|
||||
* 参数有效性验证
|
||||
*
|
||||
* @param type {@link CheckValidityType}
|
||||
* @param value {@link String}
|
||||
* @param appId {@link Long}
|
||||
* @param id {@link Long}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
Boolean permissionRoleParamCheck(CheckValidityType type, String value, Long appId, Long id);
|
||||
|
||||
/**
|
||||
* 更新角色状态
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @param status {@link Boolean}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
Boolean updatePermissionRoleStatus(String id, Boolean status);
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.service.permission.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.PermissionResourceEntity;
|
||||
import cn.topiam.employee.console.converter.permission.PermissionActionConverter;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.querydsl.core.types.Predicate;
|
||||
|
||||
import cn.topiam.employee.common.repository.permission.AppPermissionResourceRepository;
|
||||
import cn.topiam.employee.console.pojo.query.permission.PermissionActionListQuery;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionActionListResult;
|
||||
import cn.topiam.employee.console.service.permission.PermissionActionService;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 资源权限 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020-08-10
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PermissionActionServiceImpl implements PermissionActionService {
|
||||
|
||||
/**
|
||||
* 获取资源列表
|
||||
*
|
||||
* @param query {@link PermissionActionListQuery}
|
||||
* @return {@link PermissionActionListResult}
|
||||
*/
|
||||
@Override
|
||||
public List<PermissionActionListResult> getPermissionActionList(PermissionActionListQuery query) {
|
||||
Predicate predicate = permissionActionConverter
|
||||
.appPermissionActionListQueryConvertToPredicate(query);
|
||||
List<PermissionResourceEntity> list = (List<PermissionResourceEntity>) appPermissionResourceRepository
|
||||
.findAll(predicate);
|
||||
return permissionActionConverter.entityConvertToResourceActionListResult(list);
|
||||
}
|
||||
|
||||
private final AppPermissionResourceRepository appPermissionResourceRepository;
|
||||
|
||||
private final PermissionActionConverter permissionActionConverter;
|
||||
}
|
|
@ -1,128 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.service.permission.impl;
|
||||
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyListResult;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionPolicyCreateParam;
|
||||
import org.springframework.data.querydsl.QPageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import cn.topiam.employee.common.entity.app.query.AppPolicyQuery;
|
||||
import cn.topiam.employee.common.entity.permission.PermissionPolicyEntity;
|
||||
import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO;
|
||||
import cn.topiam.employee.common.exception.app.AppPolicyNotExistException;
|
||||
import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository;
|
||||
import cn.topiam.employee.console.converter.permission.PermissionPolicyConverter;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionPolicyGetResult;
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionPolicyUpdateParam;
|
||||
import cn.topiam.employee.console.service.permission.PermissionPolicyService;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 权限策略 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020-08-10
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PermissionPolicyServiceImpl implements PermissionPolicyService {
|
||||
|
||||
/**
|
||||
* 获取策略列表
|
||||
*
|
||||
* @param page {@link PageModel}
|
||||
* @param query {@link AppPolicyQuery}
|
||||
* @return {@link PermissionPolicyListResult}
|
||||
*/
|
||||
@Override
|
||||
public Page<PermissionPolicyListResult> getPermissionPolicyList(PageModel page,
|
||||
AppPolicyQuery query) {
|
||||
org.springframework.data.domain.Page<PermissionPolicyPO> data;
|
||||
QPageRequest request = QPageRequest.of(page.getCurrent(), page.getPageSize());
|
||||
data = appPermissionPolicyRepository.findPage(query, request);
|
||||
return permissionPolicyConverter.entityConvertToPolicyListResult(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取策略
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link PermissionPolicyGetResult}
|
||||
*/
|
||||
@Override
|
||||
public PermissionPolicyGetResult getPermissionPolicy(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除策略
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Override
|
||||
public Boolean deletePermissionPolicy(String id) {
|
||||
Long policyId = Long.valueOf(id);
|
||||
appPermissionPolicyRepository.findById(policyId)
|
||||
.orElseThrow(AppPolicyNotExistException::new);
|
||||
appPermissionPolicyRepository.deleteById(policyId);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建策略
|
||||
*
|
||||
* @param param {@link PermissionPolicyCreateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean createPermissionPolicy(PermissionPolicyCreateParam param) {
|
||||
PermissionPolicyEntity resource = permissionPolicyConverter
|
||||
.policyCreateParamConvertToEntity(param);
|
||||
// 新增策略
|
||||
appPermissionPolicyRepository.save(resource);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新策略
|
||||
*
|
||||
* @param param {@link PermissionPolicyUpdateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Override
|
||||
public Boolean updatePermissionPolicy(PermissionPolicyUpdateParam param) {
|
||||
PermissionPolicyEntity resource = permissionPolicyConverter
|
||||
.policyUpdateParamConvertToEntity(param);
|
||||
// 更新策略
|
||||
appPermissionPolicyRepository.save(resource);
|
||||
return null;
|
||||
}
|
||||
|
||||
private final PermissionPolicyConverter permissionPolicyConverter;
|
||||
|
||||
private final AppPermissionPolicyRepository appPermissionPolicyRepository;
|
||||
}
|
|
@ -1,281 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.service.permission.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.PermissionActionEntity;
|
||||
import cn.topiam.employee.common.entity.permission.PermissionResourceEntity;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionResourceGetResult;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionResourceListResult;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionResourceCreateParam;
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionResourceUpdateParam;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.querydsl.QPageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.querydsl.core.types.Predicate;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
import cn.topiam.employee.audit.context.AuditContext;
|
||||
import cn.topiam.employee.audit.entity.Target;
|
||||
import cn.topiam.employee.audit.enums.TargetType;
|
||||
import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity;
|
||||
import cn.topiam.employee.common.enums.CheckValidityType;
|
||||
import cn.topiam.employee.common.exception.app.AppResourceNotExistException;
|
||||
import cn.topiam.employee.common.repository.permission.AppPermissionActionRepository;
|
||||
import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository;
|
||||
import cn.topiam.employee.common.repository.permission.AppPermissionResourceRepository;
|
||||
import cn.topiam.employee.console.converter.permission.PermissionResourceConverter;
|
||||
import cn.topiam.employee.console.pojo.query.permission.PermissionResourceListQuery;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionsActionParam;
|
||||
import cn.topiam.employee.console.service.permission.PermissionResourceService;
|
||||
import cn.topiam.employee.support.exception.BadParamsException;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
import cn.topiam.employee.support.util.BeanUtils;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import static cn.topiam.employee.support.repository.domain.BaseEntity.LAST_MODIFIED_BY;
|
||||
import static cn.topiam.employee.support.repository.domain.BaseEntity.LAST_MODIFIED_TIME;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 资源权限 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020-08-10
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PermissionResourceServiceImpl implements PermissionResourceService {
|
||||
|
||||
/**
|
||||
* 获取资源列表
|
||||
*
|
||||
* @param page {@link PageModel}
|
||||
* @param query {@link PermissionResourceListQuery}
|
||||
* @return {@link PermissionResourceListResult}
|
||||
*/
|
||||
@Override
|
||||
public Page<PermissionResourceListResult> getPermissionResourceList(PageModel page,
|
||||
PermissionResourceListQuery query) {
|
||||
org.springframework.data.domain.Page<PermissionResourceEntity> data;
|
||||
Predicate predicate = permissionResourceConverter
|
||||
.resourcePaginationParamConvertToPredicate(query);
|
||||
QPageRequest request = QPageRequest.of(page.getCurrent(), page.getPageSize());
|
||||
data = appResourceRepository.findAll(predicate, request);
|
||||
return permissionResourceConverter.entityConvertToResourceListResult(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取资源
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link PermissionResourceGetResult}
|
||||
*/
|
||||
@Override
|
||||
public PermissionResourceGetResult getPermissionResource(String id) {
|
||||
PermissionResourceEntity resource = appResourceRepository.findById(Long.valueOf(id))
|
||||
.orElseThrow(AppResourceNotExistException::new);
|
||||
return permissionResourceConverter.entityConvertToResourceGetResult(resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除资源
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deletePermissionResource(String id) {
|
||||
Long resourceId = Long.valueOf(id);
|
||||
PermissionResourceEntity resource = appResourceRepository.findById(resourceId)
|
||||
.orElseThrow(AppResourceNotExistException::new);
|
||||
List<PermissionActionEntity> actionList = appPermissionActionRepository
|
||||
.findAllByResource(resource);
|
||||
List<Long> objectIdList = new ArrayList<>(
|
||||
actionList.stream().map(PermissionActionEntity::getId).toList());
|
||||
objectIdList.add(resourceId);
|
||||
appPermissionPolicyRepository.deleteAllByObjectIdIn(objectIdList);
|
||||
appResourceRepository.deleteById(resourceId);
|
||||
AuditContext
|
||||
.setTarget(Target.builder().id(id).type(TargetType.APP_PERMISSION_RESOURCE).build());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用/禁用
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @param enabled {@link Boolean}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateStatus(Long id, boolean enabled) {
|
||||
PermissionResourceEntity resource = appResourceRepository.findById(Long.valueOf(id))
|
||||
.orElseThrow(AppResourceNotExistException::new);
|
||||
AuditContext.setTarget(
|
||||
Target.builder().id(id.toString()).type(TargetType.APP_PERMISSION_RESOURCE).build());
|
||||
return appPermissionPolicyRepository.updateStatus(id, enabled) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建资源
|
||||
*
|
||||
* @param param {@link PermissionResourceCreateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean createPermissionResource(PermissionResourceCreateParam param) {
|
||||
PermissionResourceEntity resource = permissionResourceConverter
|
||||
.resourceCreateParamConvertToEntity(param);
|
||||
buildActions(param.getActions(), resource);
|
||||
// 新增资源
|
||||
appResourceRepository.save(resource);
|
||||
AuditContext.setTarget(Target.builder().id(resource.getId().toString())
|
||||
.type(TargetType.APP_PERMISSION_RESOURCE).build());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新资源
|
||||
*
|
||||
* @param param {@link PermissionResourceUpdateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean updatePermissionResource(PermissionResourceUpdateParam param) {
|
||||
PermissionResourceEntity resource = permissionResourceConverter
|
||||
.resourceUpdateParamConvertToEntity(param);
|
||||
PermissionResourceEntity entity = getAppPermissionResourceEntity(
|
||||
Long.valueOf(param.getId()));
|
||||
buildActions(param.getActions(), resource);
|
||||
BeanUtils.merge(resource, entity, LAST_MODIFIED_BY, LAST_MODIFIED_TIME);
|
||||
// 查询资源下所有权限
|
||||
List<PermissionActionEntity> actionList = appPermissionActionRepository
|
||||
.findAllByResource(resource);
|
||||
// 取出未删除的权限id
|
||||
Set<Long> reservedSet = resource.getActions().stream().map(PermissionActionEntity::getId)
|
||||
.collect(Collectors.toSet());
|
||||
// 过滤要删除的权限id
|
||||
List<Long> removeActions = actionList.stream()
|
||||
.filter(item -> !reservedSet.contains(item.getId()))
|
||||
.map(PermissionActionEntity::getId).toList();
|
||||
appPermissionActionRepository.deleteAllById(removeActions);
|
||||
// 更新资源
|
||||
appResourceRepository.save(entity);
|
||||
AuditContext.setTarget(
|
||||
Target.builder().id(param.getId()).type(TargetType.APP_PERMISSION_RESOURCE).build());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用权限资源
|
||||
*
|
||||
* @param id {@link Long}
|
||||
* @return {@link PermissionResourceEntity}
|
||||
*/
|
||||
private PermissionResourceEntity getAppPermissionResourceEntity(Long id) {
|
||||
return appResourceRepository.findById(id)
|
||||
.orElseThrow(() -> new BadParamsException("应用权限资源不存在"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数有效性验证
|
||||
*
|
||||
* @param type {@link CheckValidityType}
|
||||
* @param value {@link String}
|
||||
* @param appId {@link Long}
|
||||
* @param id {@link Long}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
@Override
|
||||
public Boolean permissionResourceParamCheck(CheckValidityType type, String value, Long appId,
|
||||
Long id) {
|
||||
QAppPermissionResourceEntity role = QAppPermissionResourceEntity.appPermissionResourceEntity;
|
||||
PermissionResourceEntity entity = new PermissionResourceEntity();
|
||||
boolean result = false;
|
||||
// ID存在说明是修改操作,查询一下当前数据
|
||||
if (Objects.nonNull(id)) {
|
||||
entity = appResourceRepository.findById(id)
|
||||
.orElseThrow(AppResourceNotExistException::new);
|
||||
}
|
||||
//资源名称
|
||||
if (CheckValidityType.NAME.equals(type)) {
|
||||
if (StringUtils.equals(entity.getName(), value)) {
|
||||
return true;
|
||||
}
|
||||
BooleanExpression eq = role.name.eq(value).and(role.appId.eq(appId));
|
||||
result = !appResourceRepository.exists(eq);
|
||||
}
|
||||
//资源编码
|
||||
if (CheckValidityType.CODE.equals(type)) {
|
||||
if (StringUtils.equals(entity.getCode(), value)) {
|
||||
return true;
|
||||
}
|
||||
BooleanExpression eq = role.code.eq(value).and(role.appId.eq(appId));
|
||||
result = !appResourceRepository.exists(eq);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量处理actions
|
||||
*
|
||||
* @param permissions {@link List< PermissionsActionParam >}
|
||||
* @param resource {@link PermissionResourceEntity >}
|
||||
*/
|
||||
private void buildActions(List<PermissionsActionParam> permissions,
|
||||
PermissionResourceEntity resource) {
|
||||
// 权限
|
||||
List<PermissionActionEntity> list = new ArrayList<>();
|
||||
for (PermissionsActionParam p : permissions) {
|
||||
PermissionActionEntity entity = new PermissionActionEntity();
|
||||
entity.setResource(resource);
|
||||
entity.setType(p.getType());
|
||||
entity.setName(p.getName());
|
||||
//API需要单独处理
|
||||
entity.setValue(p.getValue());
|
||||
list.add(entity);
|
||||
}
|
||||
resource.setActions(list);
|
||||
}
|
||||
|
||||
private final PermissionResourceConverter permissionResourceConverter;
|
||||
|
||||
private final AppPermissionResourceRepository appResourceRepository;
|
||||
/**
|
||||
* PolicyRepository
|
||||
*/
|
||||
private final AppPermissionPolicyRepository appPermissionPolicyRepository;
|
||||
/**
|
||||
* ActionRepository
|
||||
*/
|
||||
private final AppPermissionActionRepository appPermissionActionRepository;
|
||||
}
|
|
@ -1,220 +0,0 @@
|
|||
/*
|
||||
* eiam-console - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.console.service.permission.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import cn.topiam.employee.console.converter.permission.PermissionRoleConverter;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionRoleListResult;
|
||||
import cn.topiam.employee.console.pojo.result.permission.PermissionRoleResult;
|
||||
import cn.topiam.employee.console.pojo.save.permission.PermissionRoleCreateParam;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.querydsl.QPageRequest;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.querydsl.core.types.Predicate;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
import cn.topiam.employee.audit.context.AuditContext;
|
||||
import cn.topiam.employee.audit.entity.Target;
|
||||
import cn.topiam.employee.audit.enums.TargetType;
|
||||
import cn.topiam.employee.common.entity.app.QAppPermissionRoleEntity;
|
||||
import cn.topiam.employee.common.entity.permission.PermissionRoleEntity;
|
||||
import cn.topiam.employee.common.enums.CheckValidityType;
|
||||
import cn.topiam.employee.common.exception.app.AppRoleNotExistException;
|
||||
import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository;
|
||||
import cn.topiam.employee.common.repository.permission.AppPermissionRoleRepository;
|
||||
import cn.topiam.employee.console.pojo.query.permission.PermissionRoleListQuery;
|
||||
import cn.topiam.employee.console.pojo.update.permission.PermissionRoleUpdateParam;
|
||||
import cn.topiam.employee.console.service.permission.PermissionRoleService;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
import cn.topiam.employee.support.util.BeanUtils;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import static cn.topiam.employee.support.repository.domain.BaseEntity.LAST_MODIFIED_BY;
|
||||
import static cn.topiam.employee.support.repository.domain.BaseEntity.LAST_MODIFIED_TIME;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020-08-10
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PermissionRoleServiceImpl implements PermissionRoleService {
|
||||
|
||||
/**
|
||||
* 获取所有角色(分页)
|
||||
*
|
||||
* @param page {@link PageModel}
|
||||
* @return {@link PermissionRoleListResult}
|
||||
*/
|
||||
@Override
|
||||
public Page<PermissionRoleListResult> getPermissionRoleList(PageModel page,
|
||||
PermissionRoleListQuery query) {
|
||||
org.springframework.data.domain.Page<PermissionRoleEntity> data;
|
||||
Predicate predicate = permissionRoleConverter
|
||||
.rolePaginationParamConvertToPredicate(query);
|
||||
QPageRequest request = QPageRequest.of(page.getCurrent(), page.getPageSize());
|
||||
data = appPermissionRoleRepository.findAll(predicate, request);
|
||||
return permissionRoleConverter.entityConvertToRolePaginationResult(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建系统
|
||||
*
|
||||
* @param param {@link PermissionRoleCreateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Override
|
||||
public boolean createPermissionRole(PermissionRoleCreateParam param) {
|
||||
PermissionRoleEntity entity = permissionRoleConverter
|
||||
.roleCreateParamConvertToEntity(param);
|
||||
appPermissionRoleRepository.save(entity);
|
||||
AuditContext.setTarget(Target.builder().id(entity.getId().toString())
|
||||
.type(TargetType.APP_PERMISSION_ROLE).build());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param param {@link PermissionRoleUpdateParam}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Override
|
||||
public boolean updatePermissionRole(PermissionRoleUpdateParam param) {
|
||||
PermissionRoleEntity source = permissionRoleConverter
|
||||
.roleUpdateParamConvertToEntity(param);
|
||||
PermissionRoleEntity target = appPermissionRoleRepository
|
||||
.findById(Long.valueOf(param.getId())).orElseThrow(AppRoleNotExistException::new);
|
||||
BeanUtils.merge(source, target, LAST_MODIFIED_TIME, LAST_MODIFIED_BY);
|
||||
appPermissionRoleRepository.save(target);
|
||||
AuditContext.setTarget(Target.builder().id(target.getId().toString())
|
||||
.type(TargetType.APP_PERMISSION_ROLE).build());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*
|
||||
* @param ids {@link String}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deletePermissionRole(String ids) {
|
||||
List<String> idList = Arrays.stream(ids.split(",")).toList();
|
||||
List<Long> longIds = idList.stream().map(Long::parseLong).toList();
|
||||
appPermissionRoleRepository.deleteAllById(longIds);
|
||||
// 删除对应策略
|
||||
appPermissionPolicyRepository.deleteAllBySubjectIdIn(idList);
|
||||
appPermissionPolicyRepository.deleteAllByObjectIdIn(longIds);
|
||||
AuditContext
|
||||
.setTarget(Target.builder().id(ids).type(TargetType.APP_PERMISSION_ROLE).build());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色详情
|
||||
*
|
||||
* @param id {@link Long}
|
||||
* @return {@link PermissionRoleResult}
|
||||
*/
|
||||
@Override
|
||||
public PermissionRoleResult getPermissionRole(Long id) {
|
||||
//查询
|
||||
Optional<PermissionRoleEntity> entity = appPermissionRoleRepository.findById(id);
|
||||
//映射
|
||||
return permissionRoleConverter.entityConvertToRoleDetailResult(entity.orElse(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数有效性验证
|
||||
*
|
||||
* @param type {@link CheckValidityType}
|
||||
* @param value {@link String}
|
||||
* @param id {@link Long}
|
||||
* @param appId {@link Long}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@SuppressWarnings("DuplicatedCode")
|
||||
@Override
|
||||
public Boolean permissionRoleParamCheck(CheckValidityType type, String value, Long appId,
|
||||
Long id) {
|
||||
QAppPermissionRoleEntity role = QAppPermissionRoleEntity.appPermissionRoleEntity;
|
||||
PermissionRoleEntity entity = new PermissionRoleEntity();
|
||||
boolean result = false;
|
||||
// ID存在说明是修改操作,查询一下当前数据
|
||||
if (Objects.nonNull(id)) {
|
||||
entity = appPermissionRoleRepository.findById(id)
|
||||
.orElseThrow(AppRoleNotExistException::new);
|
||||
}
|
||||
//角色编码
|
||||
if (CheckValidityType.CODE.equals(type)) {
|
||||
if (StringUtils.equals(entity.getCode(), value)) {
|
||||
return true;
|
||||
}
|
||||
BooleanExpression eq = role.code.eq(value);
|
||||
eq.and(role.appId.eq(appId));
|
||||
result = !appPermissionRoleRepository.exists(eq);
|
||||
}
|
||||
//角色名称
|
||||
if (CheckValidityType.NAME.equals(type)) {
|
||||
if (StringUtils.equals(entity.getName(), value)) {
|
||||
return true;
|
||||
}
|
||||
BooleanExpression eq = role.name.eq(value);
|
||||
eq.and(role.appId.eq(appId));
|
||||
result = !appPermissionRoleRepository.exists(eq);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新角色状态
|
||||
*
|
||||
* @param id {@link String}
|
||||
* @param status {@link Boolean}
|
||||
* @return {@link Boolean}
|
||||
*/
|
||||
@Override
|
||||
public Boolean updatePermissionRoleStatus(String id, Boolean status) {
|
||||
appPermissionRoleRepository.updateStatus(id, status);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户数据映射器
|
||||
*/
|
||||
private final PermissionRoleConverter permissionRoleConverter;
|
||||
/**
|
||||
* RoleRepository
|
||||
*/
|
||||
private final AppPermissionRoleRepository appPermissionRoleRepository;
|
||||
/**
|
||||
* PolicyRepository
|
||||
*/
|
||||
private final AppPermissionPolicyRepository appPermissionPolicyRepository;
|
||||
}
|
|
@ -18,9 +18,9 @@
|
|||
package cn.topiam.employee.console.service.setting;
|
||||
|
||||
import cn.topiam.employee.console.pojo.result.setting.EmailProviderConfigResult;
|
||||
import cn.topiam.employee.console.pojo.result.setting.SmsProviderConfigResult;
|
||||
import cn.topiam.employee.console.pojo.save.setting.MailProviderSaveParam;
|
||||
import cn.topiam.employee.console.pojo.save.setting.SmsProviderSaveParam;
|
||||
import cn.topiam.employee.console.pojo.result.setting.SmsProviderConfigResult;
|
||||
|
||||
/**
|
||||
* 消息设置接口
|
||||
|
|
|
@ -23,9 +23,9 @@ import cn.topiam.employee.common.entity.setting.SettingEntity;
|
|||
import cn.topiam.employee.common.repository.setting.SettingRepository;
|
||||
import cn.topiam.employee.console.converter.setting.MessageSettingConverter;
|
||||
import cn.topiam.employee.console.pojo.result.setting.EmailProviderConfigResult;
|
||||
import cn.topiam.employee.console.pojo.result.setting.SmsProviderConfigResult;
|
||||
import cn.topiam.employee.console.pojo.save.setting.MailProviderSaveParam;
|
||||
import cn.topiam.employee.console.pojo.save.setting.SmsProviderSaveParam;
|
||||
import cn.topiam.employee.console.pojo.result.setting.SmsProviderConfigResult;
|
||||
import cn.topiam.employee.console.service.setting.MessageSettingService;
|
||||
import cn.topiam.employee.support.context.ApplicationContextHelp;
|
||||
import static cn.topiam.employee.common.constant.ConfigBeanNameConstants.MAIL_PROVIDER_SEND;
|
||||
|
|
|
@ -29,37 +29,32 @@ public class OpenApiV1Constants {
|
|||
/**
|
||||
* OpenAPI 路径
|
||||
*/
|
||||
public final static String OPEN_API_V1_PATH = V1_API_PATH;
|
||||
public final static String OPEN_API_V1_PATH = V1_API_PATH;
|
||||
|
||||
public final static Integer ACCESS_TOKEN_EXPIRES_IN = 7200;
|
||||
public final static Integer ACCESS_TOKEN_EXPIRES_IN = 7200;
|
||||
|
||||
/**
|
||||
* 组名称
|
||||
*/
|
||||
public static final String OPEN_API_NAME = "开放接口";
|
||||
public static final String OPEN_API_NAME = "开放接口";
|
||||
|
||||
/**
|
||||
* 访问凭证
|
||||
*/
|
||||
public final static String AUTH_PATH = OPEN_API_V1_PATH + "/auth";
|
||||
public final static String AUTH_PATH = OPEN_API_V1_PATH + "/auth";
|
||||
|
||||
/**
|
||||
* 账户
|
||||
*/
|
||||
public final static String ACCOUNT_PATH = OPEN_API_V1_PATH + "/account";
|
||||
public final static String ACCOUNT_PATH = OPEN_API_V1_PATH + "/account";
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*/
|
||||
public final static String USER_PATH = ACCOUNT_PATH + "/user";
|
||||
public final static String USER_PATH = ACCOUNT_PATH + "/user";
|
||||
|
||||
/**
|
||||
* 组织
|
||||
*/
|
||||
public final static String ORGANIZATION_PATH = ACCOUNT_PATH + "/organization";
|
||||
|
||||
/**
|
||||
* 权限管理API 路径
|
||||
*/
|
||||
public final static String OPEN_API_PERMISSION_PATH = OPEN_API_V1_PATH + "/permission";
|
||||
public final static String ORGANIZATION_PATH = ACCOUNT_PATH + "/organization";
|
||||
}
|
||||
|
|
|
@ -25,10 +25,10 @@ import org.mapstruct.Mapping;
|
|||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import cn.topiam.employee.common.entity.account.OrganizationEntity;
|
||||
import cn.topiam.employee.openapi.pojo.request.account.save.account.OrganizationCreateParam;
|
||||
import cn.topiam.employee.openapi.pojo.request.account.update.account.OrganizationUpdateParam;
|
||||
import cn.topiam.employee.openapi.pojo.response.account.OrganizationChildResult;
|
||||
import cn.topiam.employee.openapi.pojo.response.account.OrganizationResult;
|
||||
import cn.topiam.employee.openapi.pojo.result.account.OrganizationChildResult;
|
||||
import cn.topiam.employee.openapi.pojo.result.account.OrganizationResult;
|
||||
import cn.topiam.employee.openapi.pojo.save.account.OrganizationCreateParam;
|
||||
import cn.topiam.employee.openapi.pojo.update.account.OrganizationUpdateParam;
|
||||
|
||||
/**
|
||||
* 组织架构数据映射
|
||||
|
|
|
@ -33,10 +33,10 @@ import cn.topiam.employee.common.entity.account.UserEntity;
|
|||
import cn.topiam.employee.common.entity.account.po.UserPO;
|
||||
import cn.topiam.employee.common.entity.app.AppEntity;
|
||||
import cn.topiam.employee.common.repository.app.AppRepository;
|
||||
import cn.topiam.employee.openapi.pojo.request.account.save.account.UserCreateParam;
|
||||
import cn.topiam.employee.openapi.pojo.request.account.update.account.UserUpdateParam;
|
||||
import cn.topiam.employee.openapi.pojo.response.account.UserListResult;
|
||||
import cn.topiam.employee.openapi.pojo.response.account.UserResult;
|
||||
import cn.topiam.employee.openapi.pojo.result.account.UserListResult;
|
||||
import cn.topiam.employee.openapi.pojo.result.account.UserResult;
|
||||
import cn.topiam.employee.openapi.pojo.save.account.UserCreateParam;
|
||||
import cn.topiam.employee.openapi.pojo.update.account.UserUpdateParam;
|
||||
import cn.topiam.employee.support.context.ApplicationContextHelp;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import static cn.topiam.employee.support.util.PhoneNumberUtils.getPhoneAreaCode;
|
||||
|
|
|
@ -26,8 +26,8 @@ import org.springframework.util.CollectionUtils;
|
|||
|
||||
import cn.topiam.employee.common.entity.app.AppAccountEntity;
|
||||
import cn.topiam.employee.common.entity.app.po.AppAccountPO;
|
||||
import cn.topiam.employee.openapi.pojo.request.app.save.AppAccountCreateParam;
|
||||
import cn.topiam.employee.openapi.pojo.response.app.AppAccountListResult;
|
||||
import cn.topiam.employee.openapi.pojo.result.app.AppAccountListResult;
|
||||
import cn.topiam.employee.openapi.pojo.save.app.AppAccountCreateParam;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.converter.permission;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.PermissionActionEntity;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
import cn.topiam.employee.openapi.pojo.request.app.AppPermissionsActionParam;
|
||||
|
||||
/**
|
||||
* 权限映射
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/14 22:45
|
||||
*/
|
||||
@SuppressWarnings("AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc")
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface PermissionActionConverter {
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
@Mapping(target = "resource", ignore = true)
|
||||
@Mapping(target = "remark", ignore = true)
|
||||
@Mapping(target = "id", ignore = true)
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "createBy", ignore = true)
|
||||
PermissionActionEntity toEntity(AppPermissionsActionParam dto);
|
||||
|
||||
AppPermissionsActionParam toDTO(PermissionActionEntity entities);
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.converter.permission;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.PermissionPolicyEntity;
|
||||
import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionPolicyCreateParam;
|
||||
import cn.topiam.employee.openapi.pojo.request.app.update.AppPermissionPolicyUpdateParam;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
|
||||
/**
|
||||
* 策略映射
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/14 22:45
|
||||
*/
|
||||
@Mapper(componentModel = "spring", uses = PermissionActionConverter.class)
|
||||
public interface PermissionPolicyConverter {
|
||||
|
||||
/**
|
||||
* 资源创建参数转实体类
|
||||
*
|
||||
* @param param {@link AppPermissionPolicyCreateParam}
|
||||
* @return {@link PermissionPolicyEntity}
|
||||
*/
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "id", ignore = true)
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
@Mapping(target = "remark", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "createBy", ignore = true)
|
||||
PermissionPolicyEntity policyCreateParamConvertToEntity(AppPermissionPolicyCreateParam param);
|
||||
|
||||
/**
|
||||
* 资源修改参数转实体类
|
||||
*
|
||||
* @param param {@link AppPermissionPolicyCreateParam}
|
||||
* @return {@link PermissionPolicyEntity}
|
||||
*/
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
@Mapping(target = "remark", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "createBy", ignore = true)
|
||||
PermissionPolicyEntity policyUpdateParamConvertToEntity(AppPermissionPolicyUpdateParam param);
|
||||
|
||||
/**
|
||||
* 资源转换为资源列表结果
|
||||
*
|
||||
* @param page {@link Page}
|
||||
* @return {@link Page}
|
||||
*/
|
||||
default Page<PermissionPolicyPO> entityConvertToPolicyListResult(org.springframework.data.domain.Page<PermissionPolicyPO> page) {
|
||||
Page<PermissionPolicyPO> result = new Page<>();
|
||||
List<PermissionPolicyPO> pageList = page.getContent();
|
||||
if (!CollectionUtils.isEmpty(pageList)) {
|
||||
//@formatter:off
|
||||
result.setPagination(Page.Pagination.builder()
|
||||
.total(page.getTotalElements())
|
||||
.totalPages(page.getTotalPages())
|
||||
.current(page.getPageable().getPageNumber() + 1)
|
||||
.build());
|
||||
//@formatter:on
|
||||
result.setList(pageList);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,145 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.converter.permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.PermissionResourceEntity;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import com.querydsl.core.types.ExpressionUtils;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
|
||||
import cn.topiam.employee.common.entity.app.QAppPermissionResourceEntity;
|
||||
import cn.topiam.employee.openapi.pojo.request.app.query.AppResourceListQuery;
|
||||
import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionResourceCreateParam;
|
||||
import cn.topiam.employee.openapi.pojo.request.app.update.AppPermissionResourceUpdateParam;
|
||||
import cn.topiam.employee.openapi.pojo.response.app.AppPermissionResourceGetResult;
|
||||
import cn.topiam.employee.openapi.pojo.response.app.AppPermissionResourceListResult;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
|
||||
/**
|
||||
* 资源映射
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/14 22:45
|
||||
*/
|
||||
@Mapper(componentModel = "spring", uses = PermissionActionConverter.class)
|
||||
public interface PermissionResourceConverter {
|
||||
|
||||
/**
|
||||
* 资源分页查询参数转实体
|
||||
*
|
||||
* @param query {@link AppResourceListQuery}
|
||||
* @return {@link Predicate}
|
||||
*/
|
||||
default Predicate resourcePaginationParamConvertToPredicate(AppResourceListQuery query) {
|
||||
QAppPermissionResourceEntity resource = QAppPermissionResourceEntity.appPermissionResourceEntity;
|
||||
Predicate predicate = ExpressionUtils.and(resource.isNotNull(),
|
||||
resource.deleted.eq(Boolean.FALSE));
|
||||
//查询条件
|
||||
//@formatter:off
|
||||
// 资源名称
|
||||
predicate = StringUtils.isBlank(query.getName()) ? predicate : ExpressionUtils.and(predicate, resource.name.like("%" + query.getName() + "%"));
|
||||
// TODO 从token中获取 所属应用
|
||||
// predicate = ExpressionUtils.and(predicate, resource.appId.eq(0L));
|
||||
//@formatter:on
|
||||
return predicate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源创建参数转实体类
|
||||
*
|
||||
* @param param {@link AppPermissionResourceCreateParam}
|
||||
* @return {@link PermissionResourceEntity}
|
||||
*/
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "actions", ignore = true)
|
||||
@Mapping(target = "id", ignore = true)
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
@Mapping(target = "remark", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "createBy", ignore = true)
|
||||
PermissionResourceEntity resourceCreateParamConvertToEntity(AppPermissionResourceCreateParam param);
|
||||
|
||||
/**
|
||||
* 资源修改参数转实体类
|
||||
*
|
||||
* @param param {@link AppPermissionResourceCreateParam}
|
||||
* @return {@link PermissionResourceEntity}
|
||||
*/
|
||||
@Mapping(target = "enabled", expression = "java(Boolean.TRUE)")
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "code", ignore = true)
|
||||
@Mapping(target = "appId", ignore = true)
|
||||
@Mapping(target = "actions", ignore = true)
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
@Mapping(target = "remark", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "createBy", ignore = true)
|
||||
PermissionResourceEntity resourceUpdateParamConvertToEntity(AppPermissionResourceUpdateParam param);
|
||||
|
||||
/**
|
||||
* 资源转换为资源列表结果
|
||||
*
|
||||
* @param page {@link Page}
|
||||
* @return {@link Page}
|
||||
*/
|
||||
default Page<AppPermissionResourceListResult> entityConvertToResourceListResult(org.springframework.data.domain.Page<PermissionResourceEntity> page) {
|
||||
Page<AppPermissionResourceListResult> result = new Page<>();
|
||||
List<PermissionResourceEntity> pageList = page.getContent();
|
||||
if (!CollectionUtils.isEmpty(pageList)) {
|
||||
List<AppPermissionResourceListResult> list = new ArrayList<>();
|
||||
for (PermissionResourceEntity resource : pageList) {
|
||||
list.add(entityConvertToResourceListResult(resource));
|
||||
}
|
||||
//@formatter:off
|
||||
result.setPagination(Page.Pagination.builder()
|
||||
.total(page.getTotalElements())
|
||||
.totalPages(page.getTotalPages())
|
||||
.current(page.getPageable().getPageNumber() + 1)
|
||||
.build());
|
||||
//@formatter:on
|
||||
result.setList(list);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 实体转换为资源列表结果
|
||||
*
|
||||
* @param data {@link PermissionResourceEntity}
|
||||
* @return {@link AppPermissionResourceListResult}
|
||||
*/
|
||||
AppPermissionResourceListResult entityConvertToResourceListResult(PermissionResourceEntity data);
|
||||
|
||||
/**
|
||||
* 实体转获取详情返回
|
||||
*
|
||||
* @param resource {@link PermissionResourceEntity}
|
||||
* @return {@link AppPermissionResourceGetResult}
|
||||
*/
|
||||
@Mapping(target = "actions", source = "actions")
|
||||
AppPermissionResourceGetResult entityConvertToResourceGetResult(PermissionResourceEntity resource);
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.converter.permission;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import com.querydsl.core.types.ExpressionUtils;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
|
||||
import cn.topiam.employee.common.entity.app.QAppPermissionRoleEntity;
|
||||
import cn.topiam.employee.common.entity.permission.PermissionRoleEntity;
|
||||
import cn.topiam.employee.openapi.pojo.request.app.query.AppPermissionRoleListQuery;
|
||||
import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionRoleCreateParam;
|
||||
import cn.topiam.employee.openapi.pojo.request.app.update.PermissionRoleUpdateParam;
|
||||
import cn.topiam.employee.openapi.pojo.response.app.AppPermissionRoleListResult;
|
||||
import cn.topiam.employee.openapi.pojo.response.app.AppPermissionRoleResult;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
|
||||
/**
|
||||
* 角色映射
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/14 22:45
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface PermissionRoleConverter {
|
||||
|
||||
/**
|
||||
* 角色实体转换为角色分页结果
|
||||
*
|
||||
* @param page {@link Page}
|
||||
* @return {@link Page}
|
||||
*/
|
||||
default Page<AppPermissionRoleListResult> entityConvertToRolePaginationResult(org.springframework.data.domain.Page<PermissionRoleEntity> page) {
|
||||
Page<AppPermissionRoleListResult> result = new Page<>();
|
||||
if (!CollectionUtils.isEmpty(page.getContent())) {
|
||||
List<AppPermissionRoleListResult> list = new ArrayList<>();
|
||||
for (PermissionRoleEntity user : page.getContent()) {
|
||||
list.add(entityConvertToRolePaginationResult(user));
|
||||
}
|
||||
//@formatter:off
|
||||
result.setPagination(Page.Pagination.builder()
|
||||
.total(page.getTotalElements())
|
||||
.totalPages(page.getTotalPages())
|
||||
.current(page.getPageable().getPageNumber() + 1)
|
||||
.build());
|
||||
//@formatter:on
|
||||
result.setList(list);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色实体转换为角色分页结果
|
||||
*
|
||||
* @param page {@link PermissionRoleEntity}
|
||||
* @return {@link AppPermissionRoleListResult}
|
||||
*/
|
||||
AppPermissionRoleListResult entityConvertToRolePaginationResult(PermissionRoleEntity page);
|
||||
|
||||
/**
|
||||
* 角色创建参数转换为角色实体
|
||||
*
|
||||
* @param param {@link AppPermissionRoleCreateParam}
|
||||
* @return {@link PermissionRoleEntity}
|
||||
*/
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "id", ignore = true)
|
||||
@Mapping(target = "enabled", expression = "java(Boolean.TRUE)")
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "createBy", ignore = true)
|
||||
PermissionRoleEntity roleCreateParamConvertToEntity(AppPermissionRoleCreateParam param);
|
||||
|
||||
/**
|
||||
* 角色更新参数转换为角色实体类
|
||||
*
|
||||
* @param param {@link PermissionRoleUpdateParam} 更新参数
|
||||
* @return {@link PermissionRoleEntity} 角色实体
|
||||
*/
|
||||
@Mapping(target = "deleted", ignore = true)
|
||||
@Mapping(target = "appId", ignore = true)
|
||||
@Mapping(target = "enabled", ignore = true)
|
||||
@Mapping(target = "updateTime", ignore = true)
|
||||
@Mapping(target = "updateBy", ignore = true)
|
||||
@Mapping(target = "createTime", ignore = true)
|
||||
@Mapping(target = "createBy", ignore = true)
|
||||
PermissionRoleEntity roleUpdateParamConvertToEntity(PermissionRoleUpdateParam param);
|
||||
|
||||
/**
|
||||
* 实体转系统详情结果
|
||||
*
|
||||
* @param role {@link PermissionRoleEntity}
|
||||
* @return {@link AppPermissionRoleResult}
|
||||
*/
|
||||
AppPermissionRoleResult entityConvertToRoleDetailResult(PermissionRoleEntity role);
|
||||
|
||||
/**
|
||||
* 角色分页查询参数转实体
|
||||
*
|
||||
* @param query {@link AppPermissionRoleListQuery}
|
||||
* @return {@link PermissionRoleEntity}
|
||||
*/
|
||||
default Predicate rolePaginationParamConvertToPredicate(AppPermissionRoleListQuery query) {
|
||||
QAppPermissionRoleEntity role = QAppPermissionRoleEntity.appPermissionRoleEntity;
|
||||
Predicate predicate = ExpressionUtils.and(role.isNotNull(), role.deleted.eq(Boolean.FALSE));
|
||||
//查询条件
|
||||
//@formatter:off
|
||||
// 角色名称
|
||||
predicate = StringUtils.isBlank(query.getName()) ? predicate : ExpressionUtils.and(predicate, role.name.like("%" + query.getName() + "%"));
|
||||
// 是否启用
|
||||
predicate = ObjectUtils.isEmpty(query.getEnabled()) ? predicate : ExpressionUtils.and(predicate, role.enabled.eq(query.getEnabled()));
|
||||
// 角色编码
|
||||
predicate = StringUtils.isBlank(query.getCode()) ? predicate : ExpressionUtils.and(predicate, role.code.eq(query.getCode()));
|
||||
// TODO 从token中获取 所属应用
|
||||
predicate = ExpressionUtils.and(predicate, role.appId.eq(0L));
|
||||
//@formatter:on
|
||||
return predicate;
|
||||
}
|
||||
}
|
|
@ -26,11 +26,11 @@ import org.springframework.web.bind.annotation.*;
|
|||
import cn.topiam.employee.audit.annotation.Audit;
|
||||
import cn.topiam.employee.audit.event.type.EventType;
|
||||
import cn.topiam.employee.openapi.common.OpenApiResponse;
|
||||
import cn.topiam.employee.openapi.pojo.request.account.save.account.OrganizationCreateParam;
|
||||
import cn.topiam.employee.openapi.pojo.request.account.update.account.OrganizationUpdateParam;
|
||||
import cn.topiam.employee.openapi.pojo.response.account.OrganizationChildResult;
|
||||
import cn.topiam.employee.openapi.pojo.response.account.OrganizationResult;
|
||||
import cn.topiam.employee.openapi.service.OrganizationService;
|
||||
import cn.topiam.employee.openapi.pojo.result.account.OrganizationChildResult;
|
||||
import cn.topiam.employee.openapi.pojo.result.account.OrganizationResult;
|
||||
import cn.topiam.employee.openapi.pojo.save.account.OrganizationCreateParam;
|
||||
import cn.topiam.employee.openapi.pojo.update.account.OrganizationUpdateParam;
|
||||
import cn.topiam.employee.openapi.service.account.OrganizationService;
|
||||
import cn.topiam.employee.support.lock.Lock;
|
||||
import cn.topiam.employee.support.preview.Preview;
|
||||
|
||||
|
|
|
@ -26,11 +26,11 @@ import cn.topiam.employee.audit.event.type.EventType;
|
|||
import cn.topiam.employee.common.entity.account.query.UserListQuery;
|
||||
import cn.topiam.employee.common.enums.UserStatus;
|
||||
import cn.topiam.employee.openapi.common.OpenApiResponse;
|
||||
import cn.topiam.employee.openapi.pojo.request.account.save.account.UserCreateParam;
|
||||
import cn.topiam.employee.openapi.pojo.request.account.update.account.UserUpdateParam;
|
||||
import cn.topiam.employee.openapi.pojo.response.account.UserListResult;
|
||||
import cn.topiam.employee.openapi.pojo.response.account.UserResult;
|
||||
import cn.topiam.employee.openapi.service.UserService;
|
||||
import cn.topiam.employee.openapi.pojo.result.account.UserListResult;
|
||||
import cn.topiam.employee.openapi.pojo.result.account.UserResult;
|
||||
import cn.topiam.employee.openapi.pojo.save.account.UserCreateParam;
|
||||
import cn.topiam.employee.openapi.pojo.update.account.UserUpdateParam;
|
||||
import cn.topiam.employee.openapi.service.account.UserService;
|
||||
import cn.topiam.employee.support.lock.Lock;
|
||||
import cn.topiam.employee.support.preview.Preview;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.endpoint.permission;
|
||||
|
||||
import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import cn.topiam.employee.openapi.pojo.request.app.query.OpenApiPolicyQuery;
|
||||
import cn.topiam.employee.openapi.service.PermissionPolicyService;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
import cn.topiam.employee.support.result.ApiRestResult;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import static cn.topiam.employee.openapi.constants.OpenApiV1Constants.OPEN_API_PERMISSION_PATH;
|
||||
|
||||
/**
|
||||
* 应用权限-策略开放API
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2022/9/5 21:04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = OPEN_API_PERMISSION_PATH + "/policy")
|
||||
@RequiredArgsConstructor
|
||||
public class PermissionPolicyEndpoint {
|
||||
/**
|
||||
* 获取所有策略(分页)
|
||||
*
|
||||
* @param page {@link PageModel}
|
||||
* @return {@link PermissionPolicyPO}
|
||||
*/
|
||||
@Operation(summary = "获取策略列表")
|
||||
@GetMapping(value = "/list")
|
||||
public ApiRestResult<Page<PermissionPolicyPO>> getPermissionPolicyList(PageModel page,
|
||||
@Validated OpenApiPolicyQuery query) {
|
||||
Page<PermissionPolicyPO> result = permissionPolicyService.getPermissionPolicyList(page,
|
||||
query);
|
||||
return ApiRestResult.<Page<PermissionPolicyPO>> builder().result(result).build();
|
||||
}
|
||||
|
||||
private final PermissionPolicyService permissionPolicyService;
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.endpoint.permission;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import cn.topiam.employee.openapi.pojo.request.app.query.AppResourceListQuery;
|
||||
import cn.topiam.employee.openapi.pojo.response.app.AppPermissionResourceListResult;
|
||||
import cn.topiam.employee.openapi.service.PermissionResourceService;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
import cn.topiam.employee.support.result.ApiRestResult;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import static cn.topiam.employee.openapi.constants.OpenApiV1Constants.OPEN_API_PERMISSION_PATH;
|
||||
|
||||
/**
|
||||
* 应用权限-资源开放API
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2022/9/5 21:04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = OPEN_API_PERMISSION_PATH + "/resource")
|
||||
@RequiredArgsConstructor
|
||||
public class PermissionResourceEndpoint {
|
||||
/**
|
||||
* 获取应用的所有资源(分页)
|
||||
*
|
||||
* @param page {@link PageModel}
|
||||
* @return {@link AppPermissionResourceListResult}
|
||||
*/
|
||||
@Operation(summary = "获取资源列表")
|
||||
@GetMapping(value = "/list")
|
||||
public ApiRestResult<Page<AppPermissionResourceListResult>> getPermissionResourceList(PageModel page,
|
||||
@Validated AppResourceListQuery query) {
|
||||
Page<AppPermissionResourceListResult> result = permissionResourceService
|
||||
.getPermissionResourceList(page, query);
|
||||
return ApiRestResult.<Page<AppPermissionResourceListResult>> builder().result(result)
|
||||
.build();
|
||||
}
|
||||
//2、新增资源
|
||||
|
||||
//3、编辑资源
|
||||
|
||||
//4、删除资源
|
||||
|
||||
/**
|
||||
* 资源服务类
|
||||
*/
|
||||
private final PermissionResourceService permissionResourceService;
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.endpoint.permission;
|
||||
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import cn.topiam.employee.openapi.pojo.request.app.query.AppPermissionRoleListQuery;
|
||||
import cn.topiam.employee.openapi.pojo.response.app.AppPermissionRoleListResult;
|
||||
import cn.topiam.employee.openapi.service.PermissionRoleService;
|
||||
import cn.topiam.employee.support.repository.page.domain.Page;
|
||||
import cn.topiam.employee.support.repository.page.domain.PageModel;
|
||||
import cn.topiam.employee.support.result.ApiRestResult;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import static cn.topiam.employee.openapi.constants.OpenApiV1Constants.OPEN_API_PERMISSION_PATH;
|
||||
|
||||
/**
|
||||
* 应用权限-角色开放API
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2022/9/5 21:04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(value = OPEN_API_PERMISSION_PATH + "/role")
|
||||
@RequiredArgsConstructor
|
||||
public class PermissionRoleEndpoint {
|
||||
//1、获取应用的所有角色(分页)
|
||||
/**
|
||||
* 获取所有角色(分页)
|
||||
*
|
||||
* @param page {@link PageModel}
|
||||
* @return {@link AppPermissionRoleListResult}
|
||||
*/
|
||||
@Operation(summary = "获取角色列表")
|
||||
@GetMapping(value = "/list")
|
||||
public ApiRestResult<Page<AppPermissionRoleListResult>> getPermissionRoleList(PageModel page,
|
||||
@Validated AppPermissionRoleListQuery query) {
|
||||
Page<AppPermissionRoleListResult> result = permissionRoleService
|
||||
.getPermissionRoleList(page, query);
|
||||
return ApiRestResult.<Page<AppPermissionRoleListResult>> builder().result(result).build();
|
||||
}
|
||||
//2、新增角色
|
||||
|
||||
//3、编辑角色
|
||||
|
||||
//4、删除角色
|
||||
|
||||
/**
|
||||
* 角色服务类
|
||||
*/
|
||||
private final PermissionRoleService permissionRoleService;
|
||||
}
|
|
@ -15,4 +15,4 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.service.impl;
|
||||
package cn.topiam.employee.openapi.pojo.query;
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.account.save;
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.account.update;
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.app;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.topiam.employee.common.enums.PermissionActionType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* AppPermissionsActionParam
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2022/9/1 00:18
|
||||
*/
|
||||
@Data
|
||||
@Valid
|
||||
public class AppPermissionsActionParam implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -6391182747252245592L;
|
||||
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
@NotNull(message = "权限类型")
|
||||
private PermissionActionType type;
|
||||
/**
|
||||
* 权限值
|
||||
*/
|
||||
@NotEmpty(message = "权限值")
|
||||
private String value;
|
||||
/**
|
||||
* 权限描述
|
||||
*/
|
||||
@NotEmpty(message = "权限描述")
|
||||
private String name;
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.app.query;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 查询权限列表入参
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/11 23:08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "查询权限列表入参")
|
||||
@ParameterObject
|
||||
public class AppPermissionListQuery implements Serializable {
|
||||
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
@Parameter(description = "权限名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 所属资源
|
||||
*/
|
||||
@NotNull(message = "请选择权限所属资源")
|
||||
@Parameter(description = "所属资源")
|
||||
private Long resourceId;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Parameter(description = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.app.query;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 分页查询角色入参
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/11 23:08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "查询角色列表入参")
|
||||
@ParameterObject
|
||||
public class AppPermissionRoleListQuery implements Serializable {
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@Parameter(description = "角色名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
@Parameter(description = "角色编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Parameter(description = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.app.query;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 分页查询资源入参
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/11 23:08
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "查询权限资源列表入参")
|
||||
@ParameterObject
|
||||
public class AppResourceListQuery implements Serializable {
|
||||
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
@Parameter(description = "资源名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Parameter(description = "是否启用")
|
||||
private Boolean enabled;
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.app.query;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyEffect;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyObjectType;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicySubjectType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 分页查询策略入参
|
||||
*
|
||||
* @author TopIAM
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "查询权限策略列表入参")
|
||||
@ParameterObject
|
||||
public class OpenApiPolicyQuery implements Serializable {
|
||||
|
||||
/**
|
||||
* 授权主体Id
|
||||
*/
|
||||
@Parameter(description = "授权主体Id")
|
||||
private String subjectId;
|
||||
|
||||
/**
|
||||
* 权限主体类型(用户、角色、分组、组织机构)
|
||||
*/
|
||||
@NotNull(message = "授权主体类型不能为空")
|
||||
@Parameter(description = "授权主体类型")
|
||||
private AppPolicySubjectType subjectType;
|
||||
|
||||
/**
|
||||
* 授权客体Id
|
||||
*/
|
||||
@Parameter(description = "授权客体Id")
|
||||
private String objectId;
|
||||
|
||||
/**
|
||||
* 权限客体类型(权限、角色)
|
||||
*/
|
||||
@NotNull(message = "授权客体类型不能为空")
|
||||
@Parameter(description = "授权客体类型")
|
||||
private AppPolicyObjectType objectType;
|
||||
|
||||
/**
|
||||
* 规则效果
|
||||
*/
|
||||
@Parameter(description = "规则效果")
|
||||
private AppPolicyEffect effect;
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.app.save;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.topiam.employee.common.enums.PermissionActionType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 权限创建参数
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "创建权限入参")
|
||||
public class AppPermissionActionCreateParam implements Serializable {
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
@Schema(description = "权限名称")
|
||||
@NotBlank(message = "权限名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 权限值
|
||||
*/
|
||||
@Schema(description = "权限值")
|
||||
@NotBlank(message = "权限值不能为空")
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
@Schema(description = "权限类型")
|
||||
@NotNull(message = "权限类型不能为空")
|
||||
private PermissionActionType type;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean enabled = true;
|
||||
|
||||
/**
|
||||
* 所属资源
|
||||
*/
|
||||
@Schema(description = "所属资源")
|
||||
@NotBlank(message = "所属资源不能为空")
|
||||
private Long resourceId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.app.save;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyEffect;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyObjectType;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicySubjectType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 创建策略入参
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "创建策略入参")
|
||||
public class AppPermissionPolicyCreateParam implements Serializable {
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@NotNull(message = "资源所属应用不能为空")
|
||||
@Parameter(description = "所属应用")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 授权主体id
|
||||
*/
|
||||
@NotNull(message = "授权主体id不能为空")
|
||||
@Parameter(description = "授权主体id")
|
||||
private String subjectId;
|
||||
|
||||
/**
|
||||
* 权限主体类型(用户、角色、分组、组织机构)
|
||||
*/
|
||||
@NotNull(message = "授权主体类型不能为空")
|
||||
@Parameter(description = "授权主体类型")
|
||||
private AppPolicySubjectType subjectType;
|
||||
|
||||
/**
|
||||
* 权限客体ID
|
||||
*/
|
||||
@NotNull(message = "权限客体ID不能为空")
|
||||
@Parameter(description = "授权客体id")
|
||||
private Long objectId;
|
||||
|
||||
/**
|
||||
* 权限客体类型(权限、角色)
|
||||
*/
|
||||
@NotNull(message = "权限客体类型不能为空")
|
||||
@Parameter(description = "授权客体类型")
|
||||
private AppPolicyObjectType objectType;
|
||||
|
||||
/**
|
||||
* 授权作用
|
||||
*/
|
||||
@NotNull(message = "授权作用不能为空")
|
||||
@Parameter(description = "授权作用")
|
||||
private AppPolicyEffect effect;
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.app.save;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.openapi.pojo.request.app.AppPermissionsActionParam;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 资源创建参数
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "创建资源入参")
|
||||
public class AppPermissionResourceCreateParam implements Serializable {
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@Schema(description = "资源编码")
|
||||
@NotBlank(message = "资源编码不能为空")
|
||||
private String code;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "资源名称")
|
||||
@NotBlank(message = "资源名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "资源描述")
|
||||
@NotBlank(message = "资源描述不能为空")
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean enabled = true;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@Schema(description = "所属应用")
|
||||
@NotNull(message = "所属应用不能为空")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 资源权限
|
||||
*/
|
||||
@Schema(description = "资源权限")
|
||||
@NotNull(message = "资源权限不能为空")
|
||||
private List<AppPermissionsActionParam> actions;
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.app.save;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 角色创建参数
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "创建角色入参")
|
||||
public class AppPermissionRoleCreateParam implements Serializable {
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
@NotBlank(message = "角色编码不能为空")
|
||||
private String code;
|
||||
/**
|
||||
* 启用
|
||||
*/
|
||||
private Boolean enabled = true;
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@NotNull(message = "所属应用不能为空")
|
||||
private Long appId;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.app.update;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyEffect;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyObjectType;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicySubjectType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 修改策略入参
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "修改策略入参")
|
||||
public class AppPermissionPolicyUpdateParam implements Serializable {
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@NotNull(message = "资源所属应用不能为空")
|
||||
@Parameter(description = "所属应用")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 授权主体id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空")
|
||||
@Parameter(description = "主键id")
|
||||
private Long id;
|
||||
/**
|
||||
* 授权主体id
|
||||
*/
|
||||
@NotNull(message = "授权主体id不能为空")
|
||||
@Parameter(description = "授权主体id")
|
||||
private String subjectId;
|
||||
|
||||
/**
|
||||
* 权限主体类型(用户、角色、分组、组织机构)
|
||||
*/
|
||||
@NotNull(message = "授权主体类型不能为空")
|
||||
@Parameter(description = "授权主体类型")
|
||||
private AppPolicySubjectType subjectType;
|
||||
|
||||
/**
|
||||
* 权限客体ID
|
||||
*/
|
||||
@NotNull(message = "权限客体ID不能为空")
|
||||
@Parameter(description = "授权客体id")
|
||||
private Long objectId;
|
||||
|
||||
/**
|
||||
* 权限客体类型(权限、角色)
|
||||
*/
|
||||
@NotNull(message = "权限客体类型不能为空")
|
||||
@Parameter(description = "授权客体类型")
|
||||
private AppPolicyObjectType objectType;
|
||||
|
||||
/**
|
||||
* 授权作用
|
||||
*/
|
||||
@NotNull(message = "授权作用不能为空")
|
||||
@Parameter(description = "授权作用")
|
||||
private AppPolicyEffect effect;
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.app.update;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.openapi.pojo.request.app.AppPermissionsActionParam;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.AccessMode.READ_ONLY;
|
||||
|
||||
/**
|
||||
* 资源修改参数
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "修改资源入参")
|
||||
public class AppPermissionResourceUpdateParam implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 6021548372386059064L;
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Schema(accessMode = READ_ONLY)
|
||||
@NotBlank(message = "ID不能为空")
|
||||
private String id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "资源名称")
|
||||
@NotBlank(message = "资源名称不能为空")
|
||||
private String name;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "资源描述")
|
||||
@NotBlank(message = "资源描述不能为空")
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 资源权限
|
||||
*/
|
||||
@Schema(description = "资源权限")
|
||||
@NotNull(message = "资源权限不能为空")
|
||||
private List<AppPermissionsActionParam> actions;
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.app.update;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.AccessMode.READ_ONLY;
|
||||
|
||||
/**
|
||||
* 角色修改参数
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "修改角色入参")
|
||||
public class PermissionRoleUpdateParam implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 6021548372386059064L;
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Schema(accessMode = READ_ONLY)
|
||||
@NotBlank(message = "ID不能为空")
|
||||
private String id;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "角色名称")
|
||||
private String name;
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@Schema(description = "角色编码")
|
||||
private String code;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.request.app.update;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.topiam.employee.common.enums.PermissionActionType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.AccessMode.READ_ONLY;
|
||||
|
||||
/**
|
||||
* 资源修改参数
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:46
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "修改资源入参")
|
||||
public class ResourceActionUpdateParam implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 6021548372386059064L;
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Schema(accessMode = READ_ONLY)
|
||||
@NotBlank(message = "ID不能为空")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
@Schema(description = "权限名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 权限值
|
||||
*/
|
||||
@Schema(description = "权限值")
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
@Schema(description = "权限类型")
|
||||
private PermissionActionType type;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean enabled = true;
|
||||
|
||||
/**
|
||||
* 所属资源
|
||||
*/
|
||||
@Schema(description = "所属资源")
|
||||
@NotBlank(message = "所属资源不能为空")
|
||||
private Long resourceId;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Schema(description = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.response.app;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.topiam.employee.common.enums.PermissionActionType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 权限详情
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:45
|
||||
*/
|
||||
@Schema(description = "权限操作")
|
||||
@Data
|
||||
public class AppPermissionActionGetResult implements Serializable {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Parameter(description = "ID")
|
||||
private String id;
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
@Parameter(description = "权限名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 权限值
|
||||
*/
|
||||
@Parameter(description = "权限值")
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
@Parameter(description = "权限类型")
|
||||
private PermissionActionType type;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Parameter(description = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.response.app;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.topiam.employee.common.enums.PermissionActionType;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 查询权限列表结果
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/11 23:08
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "查询权限列表结果")
|
||||
public class AppPermissionActionListResult implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3320953184046791392L;
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Parameter(description = "ID")
|
||||
private String id;
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
@Parameter(description = "权限名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 权限值
|
||||
*/
|
||||
@Parameter(description = "权限值")
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
@Parameter(description = "权限类型")
|
||||
private PermissionActionType type;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Parameter(description = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.response.app;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyEffect;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicyObjectType;
|
||||
import cn.topiam.employee.common.enums.app.AppPolicySubjectType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 获取资源
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:45
|
||||
*/
|
||||
@Schema(description = "获取资源结果")
|
||||
@Data
|
||||
public class AppPermissionPolicyGetResult implements Serializable {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Parameter(description = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 授权主体id
|
||||
*/
|
||||
@Parameter(description = "授权主体id")
|
||||
private String subjectId;
|
||||
|
||||
/**
|
||||
* 授权主体名称
|
||||
*/
|
||||
@Parameter(description = "授权主体名称")
|
||||
private String subjectName;
|
||||
|
||||
/**
|
||||
* 权限主体类型(用户、角色、分组、组织机构)
|
||||
*/
|
||||
@Parameter(description = "授权主体类型")
|
||||
private AppPolicySubjectType subjectType;
|
||||
|
||||
/**
|
||||
* 权限客体ID
|
||||
*/
|
||||
@Parameter(description = "授权客体id")
|
||||
private Long objectId;
|
||||
|
||||
/**
|
||||
* 权限客体名菜
|
||||
*/
|
||||
@Parameter(description = "授权客体名称")
|
||||
private String objectName;
|
||||
|
||||
/**
|
||||
* 权限客体类型(权限、角色)
|
||||
*/
|
||||
@Parameter(description = "授权客体类型")
|
||||
private AppPolicyObjectType objectType;
|
||||
|
||||
/**
|
||||
* 授权作用
|
||||
*/
|
||||
@Parameter(description = "授权作用")
|
||||
private AppPolicyEffect effect;
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.response.app;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import cn.topiam.employee.common.enums.PermissionActionType;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 获取资源
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:45
|
||||
*/
|
||||
@Schema(description = "获取资源结果")
|
||||
@Data
|
||||
public class AppPermissionResourceGetResult implements Serializable {
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@Schema(description = "资源名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@Schema(description = "资源编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@Schema(description = "资源描述")
|
||||
private String desc;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@Schema(description = "所属应用")
|
||||
private Long appId;
|
||||
|
||||
/**
|
||||
* 资源权限
|
||||
*/
|
||||
@Schema(description = "资源权限")
|
||||
private List<AppPermissionsAction> actions;
|
||||
|
||||
/**
|
||||
* AppPermissionsActionParam
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2022/9/1 00:18
|
||||
*/
|
||||
@Data
|
||||
public static class AppPermissionsAction implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -6391182747252245592L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Hidden
|
||||
@Schema(description = "ID")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
@Schema(description = "权限类型")
|
||||
private PermissionActionType type;
|
||||
|
||||
/**
|
||||
* 权限值
|
||||
*/
|
||||
@Schema(description = "权限值")
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 权限描述
|
||||
*/
|
||||
@Schema(description = "权限描述")
|
||||
private String name;
|
||||
}
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.response.app;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 资源分页查询结果
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/11 23:08
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "分页查询资源结果")
|
||||
public class AppPermissionResourceListResult implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3320953184046791392L;
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Parameter(description = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
@Parameter(description = "资源名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* code
|
||||
*/
|
||||
@Parameter(description = "资源编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@Parameter(description = "所属应用")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* desc
|
||||
*/
|
||||
@Parameter(description = "描述")
|
||||
private String desc;
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.response.app;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 角色分页查询结果
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/11 23:08
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "分页查询角色结果")
|
||||
public class AppPermissionRoleListResult implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 3320953184046791392L;
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@Parameter(description = "id")
|
||||
private String id;
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@Parameter(description = "角色名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
@Parameter(description = "角色编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 所属应用
|
||||
*/
|
||||
@Parameter(description = "所属应用")
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Parameter(description = "是否启用")
|
||||
private Boolean enabled;
|
||||
/**
|
||||
* remark
|
||||
*/
|
||||
@Parameter(description = "描述")
|
||||
private String remark;
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* eiam-openapi - Employee Identity and Access Management
|
||||
* Copyright © 2022-Present Jinan Yuanchuang Network Technology Co., Ltd. (support@topiam.cn)
|
||||
*
|
||||
* This program 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.
|
||||
*
|
||||
* This program 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.response.app;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
/**
|
||||
* 获取角色
|
||||
*
|
||||
* @author TopIAM
|
||||
* Created by support@topiam.cn on 2020/8/26 21:45
|
||||
*/
|
||||
@Schema(description = "获取角色")
|
||||
@Data
|
||||
public class AppPermissionRoleResult implements Serializable {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Parameter(description = "id")
|
||||
private String id;
|
||||
/**
|
||||
* appId
|
||||
*/
|
||||
@Parameter(description = "应用ID")
|
||||
private String appId;
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@Parameter(description = "角色名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
@Parameter(description = "角色编码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@Parameter(description = "是否启用")
|
||||
private Boolean enabled;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Parameter(description = "备注")
|
||||
private String remark;
|
||||
}
|
|
@ -15,7 +15,7 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.response.account;
|
||||
package cn.topiam.employee.openapi.pojo.result.account;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
|
@ -15,7 +15,7 @@
|
|||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package cn.topiam.employee.openapi.pojo.response.account;
|
||||
package cn.topiam.employee.openapi.pojo.result.account;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue