diff --git a/eiam-application/eiam-application-jwt/src/main/java/cn/topiam/employee/application/jwt/converter/AppJwtConfigConverter.java b/eiam-application/eiam-application-jwt/src/main/java/cn/topiam/employee/application/jwt/converter/AppJwtConfigConverter.java index 4b11ec9a..0d91b927 100644 --- a/eiam-application/eiam-application-jwt/src/main/java/cn/topiam/employee/application/jwt/converter/AppJwtConfigConverter.java +++ b/eiam-application/eiam-application-jwt/src/main/java/cn/topiam/employee/application/jwt/converter/AppJwtConfigConverter.java @@ -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 } diff --git a/eiam-application/eiam-application-jwt/src/main/java/cn/topiam/employee/application/jwt/pojo/AppJwtProtocolEndpoint.java b/eiam-application/eiam-application-jwt/src/main/java/cn/topiam/employee/application/jwt/pojo/AppJwtProtocolEndpoint.java index 271abed1..8cb41fda 100644 --- a/eiam-application/eiam-application-jwt/src/main/java/cn/topiam/employee/application/jwt/pojo/AppJwtProtocolEndpoint.java +++ b/eiam-application/eiam-application-jwt/src/main/java/cn/topiam/employee/application/jwt/pojo/AppJwtProtocolEndpoint.java @@ -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; } diff --git a/eiam-application/eiam-application-oidc/src/main/java/cn/topiam/employee/application/oidc/pojo/AppOidcStandardSaveConfigParam.java b/eiam-application/eiam-application-oidc/src/main/java/cn/topiam/employee/application/oidc/pojo/AppOidcStandardSaveConfigParam.java index c1b33cbd..75f520a1 100644 --- a/eiam-application/eiam-application-oidc/src/main/java/cn/topiam/employee/application/oidc/pojo/AppOidcStandardSaveConfigParam.java +++ b/eiam-application/eiam-application-oidc/src/main/java/cn/topiam/employee/application/oidc/pojo/AppOidcStandardSaveConfigParam.java @@ -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; diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/constant/PermissionConstants.java b/eiam-common/src/main/java/cn/topiam/employee/common/constant/PermissionConstants.java deleted file mode 100644 index 2db4880b..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/constant/PermissionConstants.java +++ /dev/null @@ -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; -} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/constant/ProtocolConstants.java b/eiam-common/src/main/java/cn/topiam/employee/common/constant/ProtocolConstants.java index bdc6a600..8f19efe2 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/constant/ProtocolConstants.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/constant/ProtocolConstants.java @@ -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 发起 */ diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppPolicyQuery.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppPolicyQuery.java deleted file mode 100644 index 88f50760..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/app/query/AppPolicyQuery.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionActionEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionActionEntity.java deleted file mode 100644 index 8655e58b..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionActionEntity.java +++ /dev/null @@ -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 . - */ -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 { - - @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; -} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionPolicyEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionPolicyEntity.java deleted file mode 100644 index 8ca2d8f8..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionPolicyEntity.java +++ /dev/null @@ -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 . - */ -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 { - - /** - * 应用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; -} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionResourceEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionResourceEntity.java deleted file mode 100644 index 99fbf8a3..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionResourceEntity.java +++ /dev/null @@ -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 . - */ -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; - -/** - *

- * 应用资源关联 - *

- * - * @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 { - - @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 actions; -} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionRoleEntity.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionRoleEntity.java deleted file mode 100644 index 5e3055ae..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/PermissionRoleEntity.java +++ /dev/null @@ -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 . - */ -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; - -/** - *

- * 应用角色表 - *

- * - * @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 { - - @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; -} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/po/PermissionPolicyPO.java b/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/po/PermissionPolicyPO.java deleted file mode 100644 index 662d7991..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/entity/permission/po/PermissionPolicyPO.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppJwtConfigRepositoryCustomizedImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppJwtConfigRepositoryCustomizedImpl.java index 0e8b0cea..d78065ee 100644 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppJwtConfigRepositoryCustomizedImpl.java +++ b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppJwtConfigRepositoryCustomizedImpl.java @@ -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获取 diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppPermissionPolicyRepositoryCustomizedImpl.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppPermissionPolicyRepositoryCustomizedImpl.java deleted file mode 100644 index fcdd0f8e..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/AppPermissionPolicyRepositoryCustomizedImpl.java +++ /dev/null @@ -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 . - */ -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 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 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 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; -} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/mapper/AppPermissionPolicyPoMapper.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/mapper/AppPermissionPolicyPoMapper.java deleted file mode 100644 index 54863c41..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/app/impl/mapper/AppPermissionPolicyPoMapper.java +++ /dev/null @@ -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 . - */ -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 { - - /** - * 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; - } -} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionActionRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionActionRepository.java deleted file mode 100644 index e0ca3d2e..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionActionRepository.java +++ /dev/null @@ -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 . - */ -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, - QuerydslPredicateExecutor { - /** - * findAllByResource - * - * @param resource {@link PermissionResourceEntity} - * @return {@link List} - */ - List findAllByResource(PermissionResourceEntity resource); -} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepository.java deleted file mode 100644 index 4bea3303..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepository.java +++ /dev/null @@ -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 . - */ -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, - QuerydslPredicateExecutor { - /** - * 按主体 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 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 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); -} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepositoryCustomized.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepositoryCustomized.java deleted file mode 100644 index c65c1ee0..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionPolicyRepositoryCustomized.java +++ /dev/null @@ -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 . - */ -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 findPage(AppPolicyQuery query, Pageable request); -} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionResourceRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionResourceRepository.java deleted file mode 100644 index 169e5293..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionResourceRepository.java +++ /dev/null @@ -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 . - */ -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; - -/** - *

- * 资源权限 Repository 接口 SystemRepositoryCustomized - *

- * - * @author TopIAM - * Created by support@topiam.cn on 2020-08-10 - */ -@Repository -public interface AppPermissionResourceRepository extends - LogicDeleteRepository, - QuerydslPredicateExecutor { - - /** - * 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 findByIdContainsDeleted(@NotNull @Param(value = "id") Long id); -} diff --git a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionRoleRepository.java b/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionRoleRepository.java deleted file mode 100644 index c545d62d..00000000 --- a/eiam-common/src/main/java/cn/topiam/employee/common/repository/permission/AppPermissionRoleRepository.java +++ /dev/null @@ -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 . - */ -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; - -/** - *

- * 角色表 Repository 接口 - *

- * - * @author TopIAM - * Created by support@topiam.cn on 2020-08-10 - */ -@Repository -public interface AppPermissionRoleRepository extends - LogicDeleteRepository, - QuerydslPredicateExecutor { - /** - * 更新角色状态 - * - * @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 findByIdContainsDeleted(@NotNull @Param(value = "id") Long id); -} diff --git a/eiam-common/src/main/resources/db/1.1.0-changelog.xml b/eiam-common/src/main/resources/db/1.1.0-changelog.xml index ceb1a98d..8f720aa8 100644 --- a/eiam-common/src/main/resources/db/1.1.0-changelog.xml +++ b/eiam-common/src/main/resources/db/1.1.0-changelog.xml @@ -82,143 +82,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/eiam-console/src/main/console-fe/package.json b/eiam-console/src/main/console-fe/package.json index af7794bc..409cbe6f 100644 --- a/eiam-console/src/main/console-fe/package.json +++ b/eiam-console/src/main/console-fe/package.json @@ -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", diff --git a/eiam-console/src/main/console-fe/src/pages/app/AppDetail/components/AppProtocol/JwtProtocolConfig/ConfigAbout.tsx b/eiam-console/src/main/console-fe/src/pages/app/AppDetail/components/AppProtocol/JwtProtocolConfig/ConfigAbout.tsx index 907c0e27..1eff1003 100644 --- a/eiam-console/src/main/console-fe/src/pages/app/AppDetail/components/AppProtocol/JwtProtocolConfig/ConfigAbout.tsx +++ b/eiam-console/src/main/console-fe/src/pages/app/AppDetail/components/AppProtocol/JwtProtocolConfig/ConfigAbout.tsx @@ -141,6 +141,22 @@ export default (props: { }} fieldProps={{ autoComplete: 'off' }} /> + { + return value && {value}; + }, + }} + fieldProps={{ autoComplete: 'off' }} + /> . - */ -import Role from './Role'; - -export default () => { - return ; -}; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionActionController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionActionController.java deleted file mode 100644 index 93c6de53..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionActionController.java +++ /dev/null @@ -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 . - */ -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> getPermissionActionList(@Validated PermissionActionListQuery query) { - List list = permissionActionService - .getPermissionActionList(query); - return ApiRestResult.> builder().result(list).build(); - } - - private final PermissionActionService permissionActionService; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionPolicyController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionPolicyController.java deleted file mode 100644 index 34af7aeb..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionPolicyController.java +++ /dev/null @@ -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 . - */ -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> getPermissionPolicyList(PageModel page, - @Validated AppPolicyQuery query) { - Page result = permissionPolicyService - .getPermissionPolicyList(page, query); - return ApiRestResult.> 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 createPolicy(@Validated @RequestBody PermissionPolicyCreateParam param) { - return ApiRestResult. 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 updatePolicy(@Validated PermissionPolicyUpdateParam param) { - return ApiRestResult. 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 deletePermissionPolicy(@PathVariable(value = "id") String id) { - return ApiRestResult. 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 getPermissionPolicy(@PathVariable(value = "id") String id) { - //返回 - return ApiRestResult. builder() - .result(permissionPolicyService.getPermissionPolicy(id)).build(); - } - - private final PermissionPolicyService permissionPolicyService; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionResourceController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionResourceController.java deleted file mode 100644 index 69136278..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionResourceController.java +++ /dev/null @@ -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 . - */ -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> getPermissionResourceList(PageModel page, - @Validated PermissionResourceListQuery query) { - Page result = permissionResourceService - .getPermissionResourceList(page, query); - return ApiRestResult.> 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 createResource(@Validated @RequestBody PermissionResourceCreateParam param) { - return ApiRestResult. 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 updateResource(@RequestBody @Validated PermissionResourceUpdateParam param) { - return ApiRestResult. 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 deletePermissionResource(@PathVariable(value = "id") String id) { - return ApiRestResult. 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 getPermissionResource(@PathVariable(value = "id") String id) { - //返回 - return ApiRestResult. 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 enableOrganization(@PathVariable(value = "id") Long id) { - return ApiRestResult. 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 disableOrganization(@PathVariable(value = "id") Long id) { - return ApiRestResult. 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 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. builder().result(result).build(); - } - - /** - * 资源服务类 - */ - private final PermissionResourceService permissionResourceService; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionRoleController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionRoleController.java deleted file mode 100644 index 68fe9234..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/permission/PermissionRoleController.java +++ /dev/null @@ -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 . - */ -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> getPermissionRoleList(PageModel page, - @Validated PermissionRoleListQuery query) { - Page result = permissionRoleService - .getPermissionRoleList(page, query); - return ApiRestResult.> 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 createPermissionRole(@Validated @RequestBody PermissionRoleCreateParam param) { - return ApiRestResult. 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 updatePermissionRole(@RequestBody @Validated PermissionRoleUpdateParam param) { - return ApiRestResult. 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 deletePermissionRole(@PathVariable(value = "ids") String ids) { - return ApiRestResult. 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 getPermissionRole(@PathVariable(value = "id") Long id) { - PermissionRoleResult details = permissionRoleService.getPermissionRole(id); - //返回 - return ApiRestResult. 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 enablePermissionRole(@PathVariable(value = "id") String id) { - Boolean result = permissionRoleService.updatePermissionRoleStatus(id, Boolean.TRUE); - return ApiRestResult. 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 disablePermissionRole(@PathVariable(value = "id") String id) { - Boolean result = permissionRoleService.updatePermissionRoleStatus(id, Boolean.FALSE); - return ApiRestResult. 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 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. builder().result(result).build(); - } - - /** - * 角色服务类 - */ - private final PermissionRoleService permissionRoleService; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/controller/setting/SmsProviderController.java b/eiam-console/src/main/java/cn/topiam/employee/console/controller/setting/SmsProviderController.java index f513414e..6f603942 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/controller/setting/SmsProviderController.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/controller/setting/SmsProviderController.java @@ -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; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppGroupConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppGroupConverter.java index 3315f0f4..5125d15f 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppGroupConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/app/AppGroupConverter.java @@ -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) diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionActionConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionActionConverter.java deleted file mode 100644 index ef46a91b..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionActionConverter.java +++ /dev/null @@ -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 . - */ -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 entityConvertToResourceActionListResult(List list) { - List results = new ArrayList<>(); - List menus = new ArrayList<>(); - List apis = new ArrayList<>(); - List buttons = new ArrayList<>(); - List others = new ArrayList<>(); - List 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); - -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionPolicyConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionPolicyConverter.java deleted file mode 100644 index 437723ea..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionPolicyConverter.java +++ /dev/null @@ -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 . - */ -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 entityConvertToPolicyListResult(org.springframework.data.domain.Page page) { - Page result = new Page<>(); - List 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 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); -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionResourceConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionResourceConverter.java deleted file mode 100644 index ce6df9ea..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionResourceConverter.java +++ /dev/null @@ -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 . - */ -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 entityConvertToResourceListResult(org.springframework.data.domain.Page page) { - Page result = new Page<>(); - List pageList = page.getContent(); - if (!CollectionUtils.isEmpty(pageList)) { - List 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); -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionRoleConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionRoleConverter.java deleted file mode 100644 index 18b1310a..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/permission/PermissionRoleConverter.java +++ /dev/null @@ -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 . - */ -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 entityConvertToRolePaginationResult(org.springframework.data.domain.Page page) { - Page result = new Page<>(); - if (!CollectionUtils.isEmpty(page.getContent())) { - List 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; - } -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/converter/setting/MessageSettingConverter.java b/eiam-console/src/main/java/cn/topiam/employee/console/converter/setting/MessageSettingConverter.java index 58aa8537..d95a2be0 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/converter/setting/MessageSettingConverter.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/converter/setting/MessageSettingConverter.java @@ -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; diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionActionListQuery.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionActionListQuery.java deleted file mode 100644 index 05443c23..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionActionListQuery.java +++ /dev/null @@ -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 . - */ -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; - -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionResourceListQuery.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionResourceListQuery.java deleted file mode 100644 index 881fcc6c..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionResourceListQuery.java +++ /dev/null @@ -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 . - */ -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; - -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionRoleListQuery.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionRoleListQuery.java deleted file mode 100644 index 274da7d2..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/query/permission/PermissionRoleListQuery.java +++ /dev/null @@ -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 . - */ -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; - -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionActionListResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionActionListResult.java deleted file mode 100644 index 2a37d159..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionActionListResult.java +++ /dev/null @@ -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 . - */ -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 menus; - - /** - * 操作权限 - */ - @Parameter(description = "操作权限") - private List buttons; - - /** - * 接口权限 - */ - @Parameter(description = "接口权限") - private List apis; - - /** - * 操作权限 - */ - @Parameter(description = "数据权限") - private List datas; - - /** - * 其他权限 - */ - @Parameter(description = "其他权限") - private List 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; - } -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionPolicyGetResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionPolicyGetResult.java deleted file mode 100644 index b0b5435a..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionPolicyGetResult.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionPolicyListResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionPolicyListResult.java deleted file mode 100644 index ef63b925..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionPolicyListResult.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionResourceGetResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionResourceGetResult.java deleted file mode 100644 index 935fc308..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionResourceGetResult.java +++ /dev/null @@ -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 . - */ -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 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; - } -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionResourceListResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionResourceListResult.java deleted file mode 100644 index 9bfd4e76..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionResourceListResult.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionRoleListResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionRoleListResult.java deleted file mode 100644 index 7eff2e24..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionRoleListResult.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionRoleResult.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionRoleResult.java deleted file mode 100644 index 8d55e0ad..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/result/permission/PermissionRoleResult.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionPolicyCreateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionPolicyCreateParam.java deleted file mode 100644 index 29df6b23..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionPolicyCreateParam.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionResourceCreateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionResourceCreateParam.java deleted file mode 100644 index f64fe0d4..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionResourceCreateParam.java +++ /dev/null @@ -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 . - */ -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 actions; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionRoleCreateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionRoleCreateParam.java deleted file mode 100644 index da172ade..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionRoleCreateParam.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionsActionParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionsActionParam.java deleted file mode 100644 index 1c64dd1c..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/save/permission/PermissionsActionParam.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionPolicyUpdateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionPolicyUpdateParam.java deleted file mode 100644 index 9382280c..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionPolicyUpdateParam.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionResourceUpdateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionResourceUpdateParam.java deleted file mode 100644 index 008eb59a..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionResourceUpdateParam.java +++ /dev/null @@ -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 . - */ -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 actions; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionRoleUpdateParam.java b/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionRoleUpdateParam.java deleted file mode 100644 index 855df4fe..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/pojo/update/permission/PermissionRoleUpdateParam.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionActionService.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionActionService.java deleted file mode 100644 index bc6f375e..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionActionService.java +++ /dev/null @@ -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 . - */ -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; - -/** - *

- * 权限 服务类 - *

- * - * @author TopIAM - * Created by support@topiam.cn on 2020-08-10 - */ -public interface PermissionActionService { - - /** - * 获取资源权限列表 - * - * @param query {@link PermissionActionListQuery} - * @return {@link PermissionActionListResult} - */ - List getPermissionActionList(PermissionActionListQuery query); - -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionPolicyService.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionPolicyService.java deleted file mode 100644 index 6eec5049..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionPolicyService.java +++ /dev/null @@ -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 . - */ -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; - -/** - *

- * 权限策略 服务类 - *

- * - * @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 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); -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionResourceService.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionResourceService.java deleted file mode 100644 index 19ae316e..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionResourceService.java +++ /dev/null @@ -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 . - */ -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; - -/** - *

- * 资源权限 服务类 - *

- * - * @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 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); -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionRoleService.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionRoleService.java deleted file mode 100644 index b33618fa..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/PermissionRoleService.java +++ /dev/null @@ -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 . - */ -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; - -/** - *

- * 角色表 服务类 - *

- * - * @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 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); -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionActionServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionActionServiceImpl.java deleted file mode 100644 index e4220d5a..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionActionServiceImpl.java +++ /dev/null @@ -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 . - */ -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; - -/** - *

- * 资源权限 服务类 - *

- * - * @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 getPermissionActionList(PermissionActionListQuery query) { - Predicate predicate = permissionActionConverter - .appPermissionActionListQueryConvertToPredicate(query); - List list = (List) appPermissionResourceRepository - .findAll(predicate); - return permissionActionConverter.entityConvertToResourceActionListResult(list); - } - - private final AppPermissionResourceRepository appPermissionResourceRepository; - - private final PermissionActionConverter permissionActionConverter; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionPolicyServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionPolicyServiceImpl.java deleted file mode 100644 index d5759175..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionPolicyServiceImpl.java +++ /dev/null @@ -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 . - */ -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; - -/** - *

- * 权限策略 服务实现类 - *

- * - * @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 getPermissionPolicyList(PageModel page, - AppPolicyQuery query) { - org.springframework.data.domain.Page 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; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionResourceServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionResourceServiceImpl.java deleted file mode 100644 index 5e274505..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionResourceServiceImpl.java +++ /dev/null @@ -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 . - */ -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; - -/** - *

- * 资源权限 服务实现类 - *

- * - * @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 getPermissionResourceList(PageModel page, - PermissionResourceListQuery query) { - org.springframework.data.domain.Page 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 actionList = appPermissionActionRepository - .findAllByResource(resource); - List 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 actionList = appPermissionActionRepository - .findAllByResource(resource); - // 取出未删除的权限id - Set reservedSet = resource.getActions().stream().map(PermissionActionEntity::getId) - .collect(Collectors.toSet()); - // 过滤要删除的权限id - List 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 permissions, - PermissionResourceEntity resource) { - // 权限 - List 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; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionRoleServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionRoleServiceImpl.java deleted file mode 100644 index 23fd1101..00000000 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/permission/impl/PermissionRoleServiceImpl.java +++ /dev/null @@ -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 . - */ -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; - -/** - *

- * 角色表 服务实现类 - *

- * - * @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 getPermissionRoleList(PageModel page, - PermissionRoleListQuery query) { - org.springframework.data.domain.Page 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 idList = Arrays.stream(ids.split(",")).toList(); - List 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 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; -} diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/MessageSettingService.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/MessageSettingService.java index bcf3e974..e820fb87 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/MessageSettingService.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/MessageSettingService.java @@ -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; /** * 消息设置接口 diff --git a/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/impl/MessageSettingServiceImpl.java b/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/impl/MessageSettingServiceImpl.java index 9b87d537..93f7ec24 100644 --- a/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/impl/MessageSettingServiceImpl.java +++ b/eiam-console/src/main/java/cn/topiam/employee/console/service/setting/impl/MessageSettingServiceImpl.java @@ -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; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/constants/OpenApiV1Constants.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/constants/OpenApiV1Constants.java index 6ffb5d3f..bae5dbee 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/constants/OpenApiV1Constants.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/constants/OpenApiV1Constants.java @@ -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"; } diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/account/OrganizationConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/account/OrganizationConverter.java index c3f2c7be..922c1f54 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/account/OrganizationConverter.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/account/OrganizationConverter.java @@ -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; /** * 组织架构数据映射 diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/account/UserConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/account/UserConverter.java index ef9aeca5..356fbefb 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/account/UserConverter.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/account/UserConverter.java @@ -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; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppAccountConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppAccountConverter.java index 45887402..bda7d3d5 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppAccountConverter.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/app/AppAccountConverter.java @@ -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; /** diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionActionConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionActionConverter.java deleted file mode 100644 index c79aa6eb..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionActionConverter.java +++ /dev/null @@ -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 . - */ -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); -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionPolicyConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionPolicyConverter.java deleted file mode 100644 index cd3c8a24..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionPolicyConverter.java +++ /dev/null @@ -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 . - */ -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 entityConvertToPolicyListResult(org.springframework.data.domain.Page page) { - Page result = new Page<>(); - List 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; - } -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionResourceConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionResourceConverter.java deleted file mode 100644 index 2bd5543f..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionResourceConverter.java +++ /dev/null @@ -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 . - */ -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 entityConvertToResourceListResult(org.springframework.data.domain.Page page) { - Page result = new Page<>(); - List pageList = page.getContent(); - if (!CollectionUtils.isEmpty(pageList)) { - List 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); -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionRoleConverter.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionRoleConverter.java deleted file mode 100644 index bb8e5cf5..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/converter/permission/PermissionRoleConverter.java +++ /dev/null @@ -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 . - */ -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 entityConvertToRolePaginationResult(org.springframework.data.domain.Page page) { - Page result = new Page<>(); - if (!CollectionUtils.isEmpty(page.getContent())) { - List 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; - } -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/account/OrganizationController.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/account/OrganizationController.java index 8f1d7122..09777c32 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/account/OrganizationController.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/account/OrganizationController.java @@ -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; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/account/UserController.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/account/UserController.java index 6b6a953d..bd7c5f86 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/account/UserController.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/account/UserController.java @@ -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; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionPolicyEndpoint.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionPolicyEndpoint.java deleted file mode 100644 index 2b736028..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionPolicyEndpoint.java +++ /dev/null @@ -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 . - */ -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> getPermissionPolicyList(PageModel page, - @Validated OpenApiPolicyQuery query) { - Page result = permissionPolicyService.getPermissionPolicyList(page, - query); - return ApiRestResult.> builder().result(result).build(); - } - - private final PermissionPolicyService permissionPolicyService; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionResourceEndpoint.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionResourceEndpoint.java deleted file mode 100644 index b3b18782..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionResourceEndpoint.java +++ /dev/null @@ -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 . - */ -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> getPermissionResourceList(PageModel page, - @Validated AppResourceListQuery query) { - Page result = permissionResourceService - .getPermissionResourceList(page, query); - return ApiRestResult.> builder().result(result) - .build(); - } - //2、新增资源 - - //3、编辑资源 - - //4、删除资源 - - /** - * 资源服务类 - */ - private final PermissionResourceService permissionResourceService; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionRoleEndpoint.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionRoleEndpoint.java deleted file mode 100644 index 692b64a3..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/PermissionRoleEndpoint.java +++ /dev/null @@ -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 . - */ -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> getPermissionRoleList(PageModel page, - @Validated AppPermissionRoleListQuery query) { - Page result = permissionRoleService - .getPermissionRoleList(page, query); - return ApiRestResult.> builder().result(result).build(); - } - //2、新增角色 - - //3、编辑角色 - - //4、删除角色 - - /** - * 角色服务类 - */ - private final PermissionRoleService permissionRoleService; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/package-info.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/query/package-info.java similarity index 94% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/package-info.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/query/package-info.java index cf2ac972..5377709f 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/package-info.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/query/package-info.java @@ -15,4 +15,4 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.service.impl; \ No newline at end of file +package cn.topiam.employee.openapi.pojo.query; \ No newline at end of file diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/save/package-info.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/save/package-info.java deleted file mode 100644 index 3d0c6082..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/save/package-info.java +++ /dev/null @@ -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 . - */ -package cn.topiam.employee.openapi.pojo.request.account.save; \ No newline at end of file diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/update/package-info.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/update/package-info.java deleted file mode 100644 index b57150b6..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/update/package-info.java +++ /dev/null @@ -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 . - */ -package cn.topiam.employee.openapi.pojo.request.account.update; \ No newline at end of file diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/AppPermissionsActionParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/AppPermissionsActionParam.java deleted file mode 100644 index 7cbadccc..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/AppPermissionsActionParam.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/query/AppPermissionListQuery.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/query/AppPermissionListQuery.java deleted file mode 100644 index 55e67761..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/query/AppPermissionListQuery.java +++ /dev/null @@ -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 . - */ -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; - -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/query/AppPermissionRoleListQuery.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/query/AppPermissionRoleListQuery.java deleted file mode 100644 index c15f492e..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/query/AppPermissionRoleListQuery.java +++ /dev/null @@ -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 . - */ -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; - -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/query/AppResourceListQuery.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/query/AppResourceListQuery.java deleted file mode 100644 index 137b9d89..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/query/AppResourceListQuery.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/query/OpenApiPolicyQuery.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/query/OpenApiPolicyQuery.java deleted file mode 100644 index 3b2ba376..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/query/OpenApiPolicyQuery.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppPermissionActionCreateParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppPermissionActionCreateParam.java deleted file mode 100644 index bdaf7662..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppPermissionActionCreateParam.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppPermissionPolicyCreateParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppPermissionPolicyCreateParam.java deleted file mode 100644 index e5e610aa..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppPermissionPolicyCreateParam.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppPermissionResourceCreateParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppPermissionResourceCreateParam.java deleted file mode 100644 index f0e7b09d..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppPermissionResourceCreateParam.java +++ /dev/null @@ -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 . - */ -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 actions; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppPermissionRoleCreateParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppPermissionRoleCreateParam.java deleted file mode 100644 index 636bda23..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppPermissionRoleCreateParam.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/update/AppPermissionPolicyUpdateParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/update/AppPermissionPolicyUpdateParam.java deleted file mode 100644 index d10af289..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/update/AppPermissionPolicyUpdateParam.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/update/AppPermissionResourceUpdateParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/update/AppPermissionResourceUpdateParam.java deleted file mode 100644 index 00a8734a..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/update/AppPermissionResourceUpdateParam.java +++ /dev/null @@ -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 . - */ -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 actions; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/update/PermissionRoleUpdateParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/update/PermissionRoleUpdateParam.java deleted file mode 100644 index 431691eb..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/update/PermissionRoleUpdateParam.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/update/ResourceActionUpdateParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/update/ResourceActionUpdateParam.java deleted file mode 100644 index ebc9971b..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/update/ResourceActionUpdateParam.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionActionGetResult.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionActionGetResult.java deleted file mode 100644 index 73a569e8..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionActionGetResult.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionActionListResult.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionActionListResult.java deleted file mode 100644 index 61ae3a4d..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionActionListResult.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionPolicyGetResult.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionPolicyGetResult.java deleted file mode 100644 index 7556de53..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionPolicyGetResult.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionResourceGetResult.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionResourceGetResult.java deleted file mode 100644 index cc5ad6cc..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionResourceGetResult.java +++ /dev/null @@ -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 . - */ -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 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; - } -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionResourceListResult.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionResourceListResult.java deleted file mode 100644 index 9d3417c1..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionResourceListResult.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionRoleListResult.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionRoleListResult.java deleted file mode 100644 index 8fc63f68..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionRoleListResult.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionRoleResult.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionRoleResult.java deleted file mode 100644 index 653a3214..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppPermissionRoleResult.java +++ /dev/null @@ -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 . - */ -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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/account/OrganizationChildResult.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/account/OrganizationChildResult.java similarity index 97% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/account/OrganizationChildResult.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/account/OrganizationChildResult.java index 90c0f256..19e104ae 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/account/OrganizationChildResult.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/account/OrganizationChildResult.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.pojo.response.account; +package cn.topiam.employee.openapi.pojo.result.account; import java.io.Serial; import java.io.Serializable; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/account/OrganizationResult.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/account/OrganizationResult.java similarity index 97% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/account/OrganizationResult.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/account/OrganizationResult.java index 49b6ffda..7373c87d 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/account/OrganizationResult.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/account/OrganizationResult.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.pojo.response.account; +package cn.topiam.employee.openapi.pojo.result.account; import java.io.Serial; import java.io.Serializable; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/account/UserListResult.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/account/UserListResult.java similarity index 98% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/account/UserListResult.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/account/UserListResult.java index 719534ac..749e8817 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/account/UserListResult.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/account/UserListResult.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.pojo.response.account; +package cn.topiam.employee.openapi.pojo.result.account; import java.io.Serial; import java.io.Serializable; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/account/UserResult.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/account/UserResult.java similarity index 98% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/account/UserResult.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/account/UserResult.java index 767a50d1..45ea63b5 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/account/UserResult.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/account/UserResult.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.pojo.response.account; +package cn.topiam.employee.openapi.pojo.result.account; import java.io.Serial; import java.io.Serializable; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppAccountListResult.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/app/AppAccountListResult.java similarity index 97% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppAccountListResult.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/app/AppAccountListResult.java index 2052a3c2..487d18e3 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/app/AppAccountListResult.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/app/AppAccountListResult.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.pojo.response.app; +package cn.topiam.employee.openapi.pojo.result.app; import java.time.LocalDateTime; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/package-info.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/package-info.java similarity index 94% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/package-info.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/package-info.java index cccb2adf..693b70f1 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/package-info.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/result/package-info.java @@ -15,4 +15,4 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.pojo.request; \ No newline at end of file +package cn.topiam.employee.openapi.pojo.result; \ No newline at end of file diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/save/account/OrganizationCreateParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/save/account/OrganizationCreateParam.java similarity index 97% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/save/account/OrganizationCreateParam.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/save/account/OrganizationCreateParam.java index 5e747b31..b40e750c 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/save/account/OrganizationCreateParam.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/save/account/OrganizationCreateParam.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.pojo.request.account.save.account; +package cn.topiam.employee.openapi.pojo.save.account; import java.io.Serial; import java.io.Serializable; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/save/account/UserCreateParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/save/account/UserCreateParam.java similarity index 98% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/save/account/UserCreateParam.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/save/account/UserCreateParam.java index 062c8495..1cce86ec 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/save/account/UserCreateParam.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/save/account/UserCreateParam.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.pojo.request.account.save.account; +package cn.topiam.employee.openapi.pojo.save.account; import java.io.Serial; import java.io.Serializable; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppAccountCreateParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/save/app/AppAccountCreateParam.java similarity index 96% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppAccountCreateParam.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/save/app/AppAccountCreateParam.java index 4d560de6..15bfe8b0 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/app/save/AppAccountCreateParam.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/save/app/AppAccountCreateParam.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.pojo.request.app.save; +package cn.topiam.employee.openapi.pojo.save.app; import lombok.Data; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/package-info.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/save/package-info.java similarity index 94% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/package-info.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/save/package-info.java index 55e00eb8..c5fae505 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/response/package-info.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/save/package-info.java @@ -15,4 +15,4 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.pojo.response; \ No newline at end of file +package cn.topiam.employee.openapi.pojo.save; \ No newline at end of file diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/update/account/OrganizationUpdateParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/update/account/OrganizationUpdateParam.java similarity index 96% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/update/account/OrganizationUpdateParam.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/update/account/OrganizationUpdateParam.java index d21ad699..2a5d640b 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/update/account/OrganizationUpdateParam.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/update/account/OrganizationUpdateParam.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.pojo.request.account.update.account; +package cn.topiam.employee.openapi.pojo.update.account; import java.io.Serial; import java.io.Serializable; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/update/account/UserUpdateParam.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/update/account/UserUpdateParam.java similarity index 97% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/update/account/UserUpdateParam.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/update/account/UserUpdateParam.java index 78bba8a2..bc4fc523 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/request/account/update/account/UserUpdateParam.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/update/account/UserUpdateParam.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.pojo.request.account.update.account; +package cn.topiam.employee.openapi.pojo.update.account; import java.io.Serial; import java.io.Serializable; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/package-info.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/update/package-info.java similarity index 93% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/package-info.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/update/package-info.java index a6bd9c56..f5ee4db6 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/endpoint/permission/package-info.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/pojo/update/package-info.java @@ -15,4 +15,4 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.endpoint.permission; \ No newline at end of file +package cn.topiam.employee.openapi.pojo.update; \ No newline at end of file diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionActionService.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionActionService.java deleted file mode 100644 index 55d4b974..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionActionService.java +++ /dev/null @@ -1,76 +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 . - */ -package cn.topiam.employee.openapi.service; - -import java.util.List; - -import cn.topiam.employee.openapi.pojo.request.app.query.AppPermissionListQuery; -import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionActionCreateParam; -import cn.topiam.employee.openapi.pojo.request.app.update.ResourceActionUpdateParam; -import cn.topiam.employee.openapi.pojo.response.app.AppPermissionActionGetResult; -import cn.topiam.employee.openapi.pojo.response.app.AppPermissionActionListResult; - -/** - *

- * 权限 服务类 - *

- * - * @author TopIAM - * Created by support@topiam.cn on 2020-08-10 - */ -public interface PermissionActionService { - /** - * 获取权限列表 - * - * @param query {@link AppPermissionListQuery} - * @return {@link AppPermissionActionListResult} - */ - List getPermissionActionList(AppPermissionListQuery query); - - /** - * 获取权限详情 - * - * @param id {@link String} - * @return {@link AppPermissionActionGetResult} - */ - AppPermissionActionGetResult getPermissionAction(String id); - - /** - * 删除权限 - * - * @param id {@link String} - * @return {@link Boolean} - */ - Boolean deletePermissionAction(String id); - - /** - * 创建权限 - * - * @param param {@link AppPermissionActionCreateParam} - * @return {@link Boolean} - */ - Boolean createPermissionAction(AppPermissionActionCreateParam param); - - /** - * 更新权限 - * - * @param param {@link ResourceActionUpdateParam} - * @return {@link Boolean} - */ - Boolean updatePermissionAction(ResourceActionUpdateParam param); -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionPolicyService.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionPolicyService.java deleted file mode 100644 index 59925f55..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionPolicyService.java +++ /dev/null @@ -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 . - */ -package cn.topiam.employee.openapi.service; - -import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO; -import cn.topiam.employee.openapi.pojo.request.app.query.OpenApiPolicyQuery; -import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionPolicyCreateParam; -import cn.topiam.employee.openapi.pojo.request.app.update.AppPermissionPolicyUpdateParam; -import cn.topiam.employee.openapi.pojo.response.app.AppPermissionPolicyGetResult; -import cn.topiam.employee.support.repository.page.domain.Page; -import cn.topiam.employee.support.repository.page.domain.PageModel; - -/** - *

- * 权限策略 服务类 - *

- * - * @author TopIAM - * Created by support@topiam.cn on 2020-08-10 - */ -public interface PermissionPolicyService { - /** - * 获取资源列表 - * - * @param page {@link PageModel} - * @param query {@link OpenApiPolicyQuery} - * @return {@link PermissionPolicyPO} - */ - Page getPermissionPolicyList(PageModel page, OpenApiPolicyQuery query); - - /** - * 获取资源 - * - * @param id {@link String} - * @return {@link AppPermissionPolicyGetResult} - */ - AppPermissionPolicyGetResult getPermissionPolicy(String id); - - /** - * 删除资源 - * - * @param id {@link String} - * @return {@link Boolean} - */ - Boolean deletePermissionPolicy(String id); - - /** - * 创建资源 - * - * @param param {@link AppPermissionPolicyCreateParam} - * @return {@link Boolean} - */ - Boolean createPermissionPolicy(AppPermissionPolicyCreateParam param); - - /** - * 更新资源 - * - * @param param {@link AppPermissionPolicyUpdateParam} - * @return {@link Boolean} - */ - Boolean updatePermissionPolicy(AppPermissionPolicyUpdateParam param); -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionResourceService.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionResourceService.java deleted file mode 100644 index 4ec6e8c1..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionResourceService.java +++ /dev/null @@ -1,90 +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 . - */ -package cn.topiam.employee.openapi.service; - -import cn.topiam.employee.common.enums.CheckValidityType; -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; -import cn.topiam.employee.support.repository.page.domain.PageModel; - -/** - *

- * 资源权限 服务类 - *

- * - * @author TopIAM - * Created by support@topiam.cn on 2020-08-10 - */ -public interface PermissionResourceService { - /** - * 获取资源列表 - * - * @param page {@link PageModel} - * @param query {@link AppResourceListQuery} - * @return {@link AppPermissionResourceListResult} - */ - Page getPermissionResourceList(PageModel page, - AppResourceListQuery query); - - /** - * 获取资源 - * - * @param id {@link String} - * @return {@link AppPermissionResourceGetResult} - */ - AppPermissionResourceGetResult getPermissionResource(String id); - - /** - * 删除资源 - * - * @param id {@link String} - * @return {@link Boolean} - */ - Boolean deletePermissionResource(String id); - - /** - * 创建资源 - * - * @param param {@link AppPermissionResourceCreateParam} - * @return {@link Boolean} - */ - Boolean createPermissionResource(AppPermissionResourceCreateParam param); - - /** - * 更新资源 - * - * @param param {@link AppPermissionResourceUpdateParam} - * @return {@link Boolean} - */ - Boolean updatePermissionResource(AppPermissionResourceUpdateParam 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); -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionRoleService.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionRoleService.java deleted file mode 100644 index 89217d9f..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/PermissionRoleService.java +++ /dev/null @@ -1,100 +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 . - */ -package cn.topiam.employee.openapi.service; - -import cn.topiam.employee.common.enums.CheckValidityType; -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; -import cn.topiam.employee.support.repository.page.domain.PageModel; - -/** - *

- * 角色表 服务类 - *

- * - * @author TopIAM - * Created by support@topiam.cn on 2020-08-10 - */ -public interface PermissionRoleService { - - /** - * 获取所有角色(分页) - * - * @param page {@link PageModel} - * @param query {@link AppPermissionRoleListQuery} - * @return {@link AppPermissionRoleListResult} - */ - Page getPermissionRoleList(PageModel page, - AppPermissionRoleListQuery query); - - /** - * 创建角色 - * - * @param param {@link AppPermissionRoleCreateParam} - * @return {@link Boolean} - */ - boolean createPermissionRole(AppPermissionRoleCreateParam 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 AppPermissionRoleResult} - */ - AppPermissionRoleResult 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); -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/OrganizationService.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/account/OrganizationService.java similarity index 85% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/OrganizationService.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/account/OrganizationService.java index 5cb7334b..f914f526 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/OrganizationService.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/account/OrganizationService.java @@ -15,14 +15,14 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.service; +package cn.topiam.employee.openapi.service.account; import java.util.List; -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; /** *

diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/UserService.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/account/UserService.java similarity index 87% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/UserService.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/account/UserService.java index 43480b92..86bb47fa 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/UserService.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/account/UserService.java @@ -15,16 +15,16 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.service; +package cn.topiam.employee.openapi.service.account; import java.io.Serializable; import cn.topiam.employee.common.entity.account.query.UserListQuery; import cn.topiam.employee.common.enums.UserStatus; -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.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/OrganizationServiceImpl.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/account/impl/OrganizationServiceImpl.java similarity index 95% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/OrganizationServiceImpl.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/account/impl/OrganizationServiceImpl.java index c84ede67..d1c55dc9 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/OrganizationServiceImpl.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/account/impl/OrganizationServiceImpl.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.service.impl; +package cn.topiam.employee.openapi.service.account.impl; import java.util.LinkedHashMap; import java.util.List; @@ -46,11 +46,11 @@ import cn.topiam.employee.core.mq.UserMessageTag; import cn.topiam.employee.openapi.constants.OpenApiStatus; import cn.topiam.employee.openapi.converter.account.OrganizationConverter; import cn.topiam.employee.openapi.exception.OpenApiException; -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.repository.domain.IdEntity; import cn.topiam.employee.support.util.BeanUtils; @@ -258,9 +258,7 @@ public class OrganizationServiceImpl implements OrganizationService { public OrganizationResult getOrganizationById(String id) { OrganizationEntity entity = organizationRepository.findById(id) .orElseThrow(() -> new OpenApiException(OpenApiStatus.DEPARTMENT_NOT_EXIST)); - OrganizationResult organizationResult = organizationConverter - .entityConvertToOrgDetailResult(entity); - return organizationResult; + return organizationConverter.entityConvertToOrgDetailResult(entity); } /** diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/UserServiceImpl.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/account/impl/UserServiceImpl.java similarity index 97% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/UserServiceImpl.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/account/impl/UserServiceImpl.java index 5677b161..6893df13 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/UserServiceImpl.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/account/impl/UserServiceImpl.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.service.impl; +package cn.topiam.employee.openapi.service.account.impl; import java.io.Serializable; import java.time.LocalDate; @@ -53,11 +53,11 @@ import cn.topiam.employee.core.mq.UserMessageTag; import cn.topiam.employee.openapi.constants.OpenApiStatus; import cn.topiam.employee.openapi.converter.account.UserConverter; import cn.topiam.employee.openapi.exception.OpenApiException; -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.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; import cn.topiam.employee.support.security.password.PasswordPolicyManager; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppAccountService.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/app/AppAccountService.java similarity index 89% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppAccountService.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/app/AppAccountService.java index 2d3689d0..49c0220d 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/AppAccountService.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/app/AppAccountService.java @@ -15,11 +15,11 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.service; +package cn.topiam.employee.openapi.service.app; import cn.topiam.employee.common.entity.app.query.AppAccountQuery; -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; import cn.topiam.employee.support.repository.page.domain.PageModel; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppAccountServiceImpl.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/app/impl/AppAccountServiceImpl.java similarity index 94% rename from eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppAccountServiceImpl.java rename to eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/app/impl/AppAccountServiceImpl.java index 92a15fea..de4e6ddd 100644 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/AppAccountServiceImpl.java +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/app/impl/AppAccountServiceImpl.java @@ -15,7 +15,7 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -package cn.topiam.employee.openapi.service.impl; +package cn.topiam.employee.openapi.service.app.impl; import java.util.Optional; @@ -32,9 +32,9 @@ import cn.topiam.employee.common.entity.app.query.AppAccountQuery; import cn.topiam.employee.common.exception.app.AppAccountExistException; import cn.topiam.employee.common.repository.app.AppAccountRepository; import cn.topiam.employee.openapi.converter.app.AppAccountConverter; -import cn.topiam.employee.openapi.pojo.request.app.save.AppAccountCreateParam; -import cn.topiam.employee.openapi.pojo.response.app.AppAccountListResult; -import cn.topiam.employee.openapi.service.AppAccountService; +import cn.topiam.employee.openapi.pojo.result.app.AppAccountListResult; +import cn.topiam.employee.openapi.pojo.save.app.AppAccountCreateParam; +import cn.topiam.employee.openapi.service.app.AppAccountService; import cn.topiam.employee.support.exception.TopIamException; import cn.topiam.employee.support.repository.page.domain.Page; import cn.topiam.employee.support.repository.page.domain.PageModel; diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/app/package-info.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/app/package-info.java new file mode 100644 index 00000000..8af32a44 --- /dev/null +++ b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/app/package-info.java @@ -0,0 +1,18 @@ +/* + * 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 . + */ +package cn.topiam.employee.openapi.service.app; \ No newline at end of file diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionActionServiceImpl.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionActionServiceImpl.java deleted file mode 100644 index c29483a2..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionActionServiceImpl.java +++ /dev/null @@ -1,99 +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 . - */ -package cn.topiam.employee.openapi.service.impl; - -import java.util.List; - -import org.springframework.stereotype.Service; - -import cn.topiam.employee.openapi.pojo.request.app.query.AppPermissionListQuery; -import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionActionCreateParam; -import cn.topiam.employee.openapi.pojo.request.app.update.ResourceActionUpdateParam; -import cn.topiam.employee.openapi.pojo.response.app.AppPermissionActionGetResult; -import cn.topiam.employee.openapi.pojo.response.app.AppPermissionActionListResult; -import cn.topiam.employee.openapi.service.PermissionActionService; - -import lombok.RequiredArgsConstructor; - -/** - *

- * 资源权限 服务类 - *

- * - * @author TopIAM - * Created by support@topiam.cn on 2020-08-10 - */ -@Service -@RequiredArgsConstructor -public class PermissionActionServiceImpl implements PermissionActionService { - - /** - * 获取权限列表 - * - * @param query {@link AppPermissionListQuery} - * @return {@link AppPermissionActionListResult} - */ - @Override - public List getPermissionActionList(AppPermissionListQuery query) { - return null; - } - - /** - * 获取权限详情 - * - * @param id {@link String} - * @return {@link AppPermissionActionGetResult} - */ - @Override - public AppPermissionActionGetResult getPermissionAction(String id) { - return null; - } - - /** - * 删除权限 - * - * @param id {@link String} - * @return {@link Boolean} - */ - @Override - public Boolean deletePermissionAction(String id) { - return null; - } - - /** - * 创建权限 - * - * @param param {@link AppPermissionActionCreateParam} - * @return {@link Boolean} - */ - @Override - public Boolean createPermissionAction(AppPermissionActionCreateParam param) { - return null; - } - - /** - * 更新权限 - * - * @param param {@link ResourceActionUpdateParam} - * @return {@link Boolean} - */ - @Override - public Boolean updatePermissionAction(ResourceActionUpdateParam param) { - return null; - } -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionPolicyServiceImpl.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionPolicyServiceImpl.java deleted file mode 100644 index 073b06ce..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionPolicyServiceImpl.java +++ /dev/null @@ -1,136 +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 . - */ -package cn.topiam.employee.openapi.service.impl; - -import cn.topiam.employee.common.entity.permission.po.PermissionPolicyPO; -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.exception.app.AppPolicyNotExistException; -import cn.topiam.employee.common.repository.permission.AppPermissionPolicyRepository; -import cn.topiam.employee.openapi.converter.permission.PermissionPolicyConverter; -import cn.topiam.employee.openapi.pojo.request.app.query.OpenApiPolicyQuery; -import cn.topiam.employee.openapi.pojo.request.app.save.AppPermissionPolicyCreateParam; -import cn.topiam.employee.openapi.pojo.request.app.update.AppPermissionPolicyUpdateParam; -import cn.topiam.employee.openapi.pojo.response.app.AppPermissionPolicyGetResult; -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 lombok.RequiredArgsConstructor; - -/** - *

- * 权限策略 服务实现类 - *

- * - * @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 OpenApiPolicyQuery} - * @return {@link PermissionPolicyPO} - */ - @Override - public Page getPermissionPolicyList(PageModel page, - OpenApiPolicyQuery query) { - AppPolicyQuery appPolicyQuery = new AppPolicyQuery(); - // TODO token获取所属应用 - // appPolicyQuery.setAppId(0L); - appPolicyQuery.setEffect(query.getEffect()); - appPolicyQuery.setSubjectId(query.getSubjectId()); - appPolicyQuery.setObjectId(query.getObjectId()); - appPolicyQuery.setSubjectType(query.getSubjectType()); - appPolicyQuery.setObjectType(query.getObjectType()); - QPageRequest request = QPageRequest.of(page.getCurrent(), page.getPageSize()); - org.springframework.data.domain.Page data = appPermissionPolicyRepository - .findPage(appPolicyQuery, request); - return permissionPolicyConverter.entityConvertToPolicyListResult(data); - } - - /** - * 获取策略 - * - * @param id {@link String} - * @return {@link AppPermissionPolicyGetResult} - */ - @Override - public AppPermissionPolicyGetResult 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 AppPermissionPolicyCreateParam} - * @return {@link Boolean} - */ - @Override - @Transactional(rollbackFor = Exception.class) - public Boolean createPermissionPolicy(AppPermissionPolicyCreateParam param) { - PermissionPolicyEntity resource = permissionPolicyConverter - .policyCreateParamConvertToEntity(param); - // 新增策略 - appPermissionPolicyRepository.save(resource); - return true; - } - - /** - * 更新策略 - * - * @param param {@link AppPermissionPolicyUpdateParam} - * @return {@link Boolean} - */ - @Override - public Boolean updatePermissionPolicy(AppPermissionPolicyUpdateParam param) { - PermissionPolicyEntity resource = permissionPolicyConverter - .policyUpdateParamConvertToEntity(param); - // 更新策略 - appPermissionPolicyRepository.save(resource); - return null; - } - - private final PermissionPolicyConverter permissionPolicyConverter; - - private final AppPermissionPolicyRepository appPermissionPolicyRepository; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionResourceServiceImpl.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionResourceServiceImpl.java deleted file mode 100644 index 3e743e11..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionResourceServiceImpl.java +++ /dev/null @@ -1,241 +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 . - */ -package cn.topiam.employee.openapi.service.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.openapi.converter.permission.PermissionResourceConverter; -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.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.openapi.pojo.request.app.AppPermissionsActionParam; -import cn.topiam.employee.openapi.pojo.request.app.query.AppResourceListQuery; -import cn.topiam.employee.openapi.pojo.request.app.query.OpenApiPolicyQuery; -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.openapi.service.PermissionResourceService; -import cn.topiam.employee.support.repository.page.domain.Page; -import cn.topiam.employee.support.repository.page.domain.PageModel; - -import lombok.RequiredArgsConstructor; - -/** - *

- * 资源权限 服务实现类 - *

- * - * @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 OpenApiPolicyQuery} - * @return {@link AppPermissionResourceListResult} - */ - @Override - public Page getPermissionResourceList(PageModel page, - AppResourceListQuery query) { - org.springframework.data.domain.Page 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 AppPermissionResourceGetResult} - */ - @Override - public AppPermissionResourceGetResult 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 actionList = appPermissionActionRepository - .findAllByResource(resource); - List objectIdList = new ArrayList<>( - actionList.stream().map(PermissionActionEntity::getId).toList()); - objectIdList.add(resourceId); - appPermissionPolicyRepository.deleteAllByObjectIdIn(objectIdList); - appResourceRepository.deleteById(resourceId); - return true; - } - - /** - * 创建资源 - * - * @param param {@link AppPermissionResourceCreateParam} - * @return {@link Boolean} - */ - @Override - @Transactional(rollbackFor = Exception.class) - public Boolean createPermissionResource(AppPermissionResourceCreateParam param) { - PermissionResourceEntity resource = permissionResourceConverter - .resourceCreateParamConvertToEntity(param); - buildActions(param.getActions(), resource); - // 新增资源 - appResourceRepository.save(resource); - return true; - } - - /** - * 更新资源 - * - * @param param {@link AppPermissionResourceUpdateParam} - * @return {@link Boolean} - */ - @Override - @Transactional(rollbackFor = Exception.class) - public Boolean updatePermissionResource(AppPermissionResourceUpdateParam param) { - PermissionResourceEntity resource = permissionResourceConverter - .resourceUpdateParamConvertToEntity(param); - buildActions(param.getActions(), resource); - // 查询资源下所有权限 - List actionList = appPermissionActionRepository - .findAllByResource(resource); - // 取出未删除的权限id - Set reservedSet = resource.getActions().stream().map(PermissionActionEntity::getId) - .collect(Collectors.toSet()); - // 过滤要删除的权限id - List removeActions = actionList.stream() - .filter(item -> reservedSet.contains(item.getId())) - .map(PermissionActionEntity::getId).toList(); - appPermissionPolicyRepository.deleteAllByObjectIdIn(removeActions); - // 更新资源 - appResourceRepository.save(resource); - return true; - } - - /** - * 参数有效性验证 - * - * @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); - eq.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); - eq.and(role.appId.eq(appId)); - result = !appResourceRepository.exists(eq); - } - return result; - } - - /** - * 批量处理actions - * - * @param permissions {@link List} - * @param resource {@link PermissionResourceEntity >} - */ - private void buildActions(List permissions, - PermissionResourceEntity resource) { - // 权限 - List list = new ArrayList<>(); - for (AppPermissionsActionParam 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; -} diff --git a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionRoleServiceImpl.java b/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionRoleServiceImpl.java deleted file mode 100644 index fbba7ea9..00000000 --- a/eiam-openapi/src/main/java/cn/topiam/employee/openapi/service/impl/PermissionRoleServiceImpl.java +++ /dev/null @@ -1,211 +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 . - */ -package cn.topiam.employee.openapi.service.impl; - -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -import cn.topiam.employee.common.entity.permission.PermissionRoleEntity; -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.common.entity.app.QAppPermissionRoleEntity; -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.openapi.converter.permission.PermissionRoleConverter; -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.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.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; - -/** - *

- * 角色表 服务实现类 - *

- * - * @author TopIAM - * Created by support@topiam.cn on 2020-08-10 - */ -@Service -@RequiredArgsConstructor -public class PermissionRoleServiceImpl implements PermissionRoleService { - - /** - * 获取所有角色(分页) - * - * @param page {@link PageModel} - * @return {@link AppPermissionRoleListResult} - */ - @Override - public Page getPermissionRoleList(PageModel page, - AppPermissionRoleListQuery query) { - org.springframework.data.domain.Page 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 AppPermissionRoleCreateParam} - * @return {@link Boolean} - */ - @Override - public boolean createPermissionRole(AppPermissionRoleCreateParam param) { - PermissionRoleEntity entity = permissionRoleConverter - .roleCreateParamConvertToEntity(param); - appPermissionRoleRepository.save(entity); - 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); - return true; - } - - /** - * 删除角色 - * - * @param ids {@link String} - * @return {@link Boolean} - */ - @Override - @Transactional(rollbackFor = Exception.class) - public boolean deletePermissionRole(String ids) { - List idList = Arrays.stream(ids.split(",")).toList(); - List longIds = idList.stream().map(Long::parseLong).toList(); - appPermissionRoleRepository.deleteAllById(longIds); - // 删除对应策略 - appPermissionPolicyRepository.deleteAllBySubjectIdIn(idList); - appPermissionPolicyRepository.deleteAllByObjectIdIn(longIds); - return true; - } - - /** - * 角色详情 - * - * @param id {@link Long} - * @return {@link AppPermissionRoleResult} - */ - @Override - public AppPermissionRoleResult getPermissionRole(Long id) { - //查询 - Optional 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; -} diff --git a/eiam-portal/src/main/portal-fe/package.json b/eiam-portal/src/main/portal-fe/package.json index 26e743ea..252d7ba7 100644 --- a/eiam-portal/src/main/portal-fe/package.json +++ b/eiam-portal/src/main/portal-fe/package.json @@ -48,16 +48,16 @@ "@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", "crypto-js": "^4.1.1", - "dayjs": "^1.11.9", + "dayjs": "^1.11.10", "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,10 +70,10 @@ "qs": "^6.11.2", "query-string": "^8.1.0", "rc-menu": "^9.12.0", - "rc-select": "^14.8.1", + "rc-select": "^14.9.0", "react": "^18.2.0", "react-dom": "^18.2.0", - "react-fast-marquee": "^1.6.0", + "react-fast-marquee": "^1.6.1", "react-helmet-async": "^1.3.0", "yaml": "^2.3.2" }, @@ -81,20 +81,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", diff --git a/eiam-protocol/eiam-protocol-jwt/src/main/java/cn/topiam/employee/protocol/jwt/authentication/OidcLogoutAuthenticationProvider.java b/eiam-protocol/eiam-protocol-jwt/src/main/java/cn/topiam/employee/protocol/jwt/authentication/JwtLogoutAuthenticationProvider.java similarity index 92% rename from eiam-protocol/eiam-protocol-jwt/src/main/java/cn/topiam/employee/protocol/jwt/authentication/OidcLogoutAuthenticationProvider.java rename to eiam-protocol/eiam-protocol-jwt/src/main/java/cn/topiam/employee/protocol/jwt/authentication/JwtLogoutAuthenticationProvider.java index 887f2cf5..6f2f45c1 100644 --- a/eiam-protocol/eiam-protocol-jwt/src/main/java/cn/topiam/employee/protocol/jwt/authentication/OidcLogoutAuthenticationProvider.java +++ b/eiam-protocol/eiam-protocol-jwt/src/main/java/cn/topiam/employee/protocol/jwt/authentication/JwtLogoutAuthenticationProvider.java @@ -28,7 +28,7 @@ import org.springframework.security.core.session.SessionRegistry; * @author SanLi * Created by qinggang.zuo@gmail.com / 2689170096@qq.com on 2023/9/4 16:11 */ -public final class OidcLogoutAuthenticationProvider implements AuthenticationProvider { +public final class JwtLogoutAuthenticationProvider implements AuthenticationProvider { @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { @@ -48,7 +48,7 @@ public final class OidcLogoutAuthenticationProvider implements AuthenticationPro private final SessionRegistry sessionRegistry; - public OidcLogoutAuthenticationProvider(SessionRegistry sessionRegistry) { + public JwtLogoutAuthenticationProvider(SessionRegistry sessionRegistry) { this.sessionRegistry = sessionRegistry; } } diff --git a/eiam-protocol/eiam-protocol-jwt/src/main/java/cn/topiam/employee/protocol/jwt/configurers/JwtAuthorizationServerConfigurer.java b/eiam-protocol/eiam-protocol-jwt/src/main/java/cn/topiam/employee/protocol/jwt/configurers/JwtAuthorizationServerConfigurer.java index 1291df1f..60398fd4 100644 --- a/eiam-protocol/eiam-protocol-jwt/src/main/java/cn/topiam/employee/protocol/jwt/configurers/JwtAuthorizationServerConfigurer.java +++ b/eiam-protocol/eiam-protocol-jwt/src/main/java/cn/topiam/employee/protocol/jwt/configurers/JwtAuthorizationServerConfigurer.java @@ -111,6 +111,7 @@ public final class JwtAuthorizationServerConfigurer extends //@formatter:off Map, AbstractConfigurer> configurers = new LinkedHashMap<>(); configurers.put(JwtAuthorizationEndpointConfigurer.class, new JwtAuthorizationEndpointConfigurer(this::postProcess)); + configurers.put(JwtLogoutAuthorizationEndpointConfigurer.class, new JwtLogoutAuthorizationEndpointConfigurer(this::postProcess)); //@formatter:on return configurers; } diff --git a/eiam-protocol/eiam-protocol-jwt/src/main/java/cn/topiam/employee/protocol/jwt/configurers/JwtLogoutAuthorizationEndpointConfigurer.java b/eiam-protocol/eiam-protocol-jwt/src/main/java/cn/topiam/employee/protocol/jwt/configurers/JwtLogoutAuthorizationEndpointConfigurer.java new file mode 100644 index 00000000..36205f6e --- /dev/null +++ b/eiam-protocol/eiam-protocol-jwt/src/main/java/cn/topiam/employee/protocol/jwt/configurers/JwtLogoutAuthorizationEndpointConfigurer.java @@ -0,0 +1,91 @@ +/* + * eiam-protocol-jwt - 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 . + */ +package cn.topiam.employee.protocol.jwt.configurers; + +import org.springframework.http.HttpMethod; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.config.annotation.ObjectPostProcessor; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.core.session.SessionRegistry; +import org.springframework.security.web.authentication.logout.LogoutFilter; +import org.springframework.security.web.util.matcher.AntPathRequestMatcher; +import org.springframework.security.web.util.matcher.OrRequestMatcher; +import org.springframework.security.web.util.matcher.RequestMatcher; + +import cn.topiam.employee.protocol.code.configurer.AbstractConfigurer; +import cn.topiam.employee.protocol.code.util.ProtocolConfigUtils; +import cn.topiam.employee.protocol.jwt.authentication.JwtLogoutAuthenticationProvider; +import cn.topiam.employee.protocol.jwt.endpoint.JwtLogoutAuthenticationEndpointFilter; +import static cn.topiam.employee.common.constant.ProtocolConstants.JwtEndpointConstants.*; +import static cn.topiam.employee.protocol.code.util.ProtocolConfigUtils.getSessionRegistry; + +/** + * + * @author TopIAM + * Created by support@topiam.cn on 2023/7/5 21:58 + */ +public class JwtLogoutAuthorizationEndpointConfigurer extends AbstractConfigurer { + + private RequestMatcher requestMatcher; + + public JwtLogoutAuthorizationEndpointConfigurer(ObjectPostProcessor objectPostProcessor) { + super(objectPostProcessor); + } + + /** + * init + * + * @param httpSecurity {@link HttpSecurity} + */ + @Override + public void init(HttpSecurity httpSecurity) { + requestMatcher = new OrRequestMatcher( + new AntPathRequestMatcher(JWT_SLO_PATH, HttpMethod.POST.name())); + httpSecurity.authenticationProvider( + new JwtLogoutAuthenticationProvider(getSessionRegistry(httpSecurity))); + } + + /** + * configure + * + * @param httpSecurity {@link HttpSecurity} + */ + @Override + public void configure(HttpSecurity httpSecurity) { + AuthenticationManager authenticationManager = httpSecurity + .getSharedObject(AuthenticationManager.class); + SessionRegistry sessionRegistry = getSessionRegistry(httpSecurity); + //SLO + JwtLogoutAuthenticationEndpointFilter jwtLogoutAuthenticationEndpointFilter = new JwtLogoutAuthenticationEndpointFilter( + requestMatcher, sessionRegistry, authenticationManager); + jwtLogoutAuthenticationEndpointFilter.setAuthenticationDetailsSource( + ProtocolConfigUtils.getAuthenticationDetailsSource(httpSecurity)); + httpSecurity.addFilterBefore(postProcess(jwtLogoutAuthenticationEndpointFilter), + LogoutFilter.class); + } + + /** + * 获取请求匹配器 + * + * @return {@link RequestMatcher} + */ + @Override + public RequestMatcher getRequestMatcher() { + return requestMatcher; + } +}