管理员权限增加
This commit is contained in:
parent
e8be474500
commit
d242f4df54
@ -23,6 +23,7 @@ import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManager
|
||||
import com.red.circle.other.infra.database.rds.entity.props.RoomThemeUserBackpack;
|
||||
import com.red.circle.other.infra.database.rds.service.props.RoomThemeUserBackpackService;
|
||||
import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService;
|
||||
import com.red.circle.other.infra.database.rds.service.sys.AdministratorService;
|
||||
import com.red.circle.other.inner.asserts.RoomErrorCode;
|
||||
import com.red.circle.other.inner.enums.config.EnumConfigKey;
|
||||
import com.red.circle.other.inner.enums.material.PropsCommodityType;
|
||||
@ -52,7 +53,7 @@ public class RoomViolationAdjustCmdExe {
|
||||
private final OfficialNoticeClient officialNoticeClient;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final EnumConfigCacheService enumConfigCacheService;
|
||||
private final RoomThemeService roomThemeService;
|
||||
private final AdministratorService administratorService;
|
||||
private final RoomThemeUserBackpackService roomThemeUserBackpackService;
|
||||
|
||||
|
||||
@ -65,7 +66,7 @@ public class RoomViolationAdjustCmdExe {
|
||||
ResponseAssert.notNull(CommonErrorCode.DATA_ERROR, violationTypeEnum);
|
||||
|
||||
// 1. 验证管理员权限
|
||||
ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION,
|
||||
ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION, administratorService.existsAdmin(cmd.getReqUserId()) &&
|
||||
administratorAuthService.existsAuth(cmd.requiredReqUserId(), violationTypeEnum.name()));
|
||||
|
||||
// 2. 查询房间信息
|
||||
|
||||
@ -18,6 +18,7 @@ import com.red.circle.other.domain.violation.ViolationRecord;
|
||||
import com.red.circle.other.infra.database.mongo.entity.live.RoomProfile;
|
||||
import com.red.circle.other.infra.database.mongo.service.live.RoomProfileManagerService;
|
||||
import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService;
|
||||
import com.red.circle.other.infra.database.rds.service.sys.AdministratorService;
|
||||
import com.red.circle.other.inner.asserts.RoomErrorCode;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -39,13 +40,14 @@ public class RoomViolationWarningCmdExe {
|
||||
private final AdministratorAuthService administratorAuthService;
|
||||
private final OfficialNoticeClient officialNoticeClient;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final AdministratorService administratorService;
|
||||
|
||||
public ViolationHandleResultCO execute(RoomViolationHandleCmd cmd) {
|
||||
ViolationTypeEnum violationTypeEnum = ViolationTypeEnum.getByCode(cmd.getViolationType());
|
||||
ResponseAssert.notNull(CommonErrorCode.DATA_ERROR, violationTypeEnum);
|
||||
|
||||
// 1. 验证管理员权限
|
||||
ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION,
|
||||
ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION, administratorService.existsAdmin(cmd.getReqUserId()) &&
|
||||
administratorAuthService.existsAuth(cmd.requiredReqUserId(), violationTypeEnum.name()));
|
||||
|
||||
// 2. 查询房间信息
|
||||
|
||||
@ -17,6 +17,7 @@ import com.red.circle.other.domain.model.user.UserProfile;
|
||||
import com.red.circle.other.domain.violation.ViolationRecord;
|
||||
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
|
||||
import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService;
|
||||
import com.red.circle.other.infra.database.rds.service.sys.AdministratorService;
|
||||
import com.red.circle.other.inner.asserts.user.UserErrorCode;
|
||||
import com.red.circle.other.inner.enums.config.EnumConfigKey;
|
||||
import com.red.circle.other.inner.enums.sys.appmanager.ManagerApprovalType;
|
||||
@ -43,11 +44,12 @@ public class UserViolationAdjustCmdExe {
|
||||
private final AdministratorAuthService administratorAuthService;
|
||||
private final OfficialNoticeClient officialNoticeClient;
|
||||
private final EnumConfigCacheService enumConfigCacheService;
|
||||
private final AdministratorService administratorService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ViolationHandleResultCO execute(UserViolationHandleCmd cmd) {
|
||||
// 1. 权限验证
|
||||
ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION,
|
||||
ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION, administratorService.existsAdmin(cmd.getReqUserId()) &&
|
||||
administratorAuthService.existsAuth(cmd.requiredReqUserId(), ManagerApprovalType.USER_AVATAR.name()));
|
||||
|
||||
// 2. 查询用户信息
|
||||
|
||||
@ -16,6 +16,7 @@ import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||
import com.red.circle.other.domain.model.user.UserProfile;
|
||||
import com.red.circle.other.domain.violation.ViolationRecord;
|
||||
import com.red.circle.other.infra.database.rds.service.sys.AdministratorAuthService;
|
||||
import com.red.circle.other.infra.database.rds.service.sys.AdministratorService;
|
||||
import com.red.circle.other.inner.asserts.user.UserErrorCode;
|
||||
import com.red.circle.other.inner.enums.sys.appmanager.ManagerApprovalType;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -39,12 +40,13 @@ public class UserViolationWarningCmdExe {
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final ViolationRecordGateway violationRecordGateway;
|
||||
private final AdministratorAuthService administratorAuthService;
|
||||
private final AdministratorService administratorService;
|
||||
private final OfficialNoticeClient officialNoticeClient;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ViolationHandleResultCO execute(UserViolationHandleCmd cmd) {
|
||||
// 1. 权限验证
|
||||
ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION,
|
||||
ResponseAssert.isTrue(CommonErrorCode.INSUFFICIENT_PERMISSION,administratorService.existsAdmin(cmd.getReqUserId()) &&
|
||||
administratorAuthService.existsAuth(cmd.requiredReqUserId(), ManagerApprovalType.USER_NICKNAME.name()));
|
||||
|
||||
// 2. 查询用户信息
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user