Package com.bytedesk.core.rbac.authority
Class AuthorityRestService
java.lang.Object
com.bytedesk.core.base.BaseRestService<AuthorityEntity,AuthorityRequest,AuthorityResponse>
com.bytedesk.core.rbac.authority.AuthorityRestService
@Service
public class AuthorityRestService
extends BaseRestService<AuthorityEntity,AuthorityRequest,AuthorityResponse>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AuthorityRepositoryprivate final org.modelmapper.ModelMapperprivate final UidUtilsFields inherited from class com.bytedesk.core.base.BaseRestService
authService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertToResponse(AuthorityEntity entity) create(AuthorityRequest request) createForPlatform(String permissionValue) 创建权限(不再在权限字符串中编码层级) 约定: - SETTINGS_* 为平台级(PLATFORM) - 其余 MODULE_ACTION 默认为组织级(ORGANIZATION) 例如:传入 "TAG_READ" 只会创建: - TAG_READprotected org.springframework.data.jpa.domain.Specification<AuthorityEntity>createSpecification(AuthorityRequest request) 创建Specification对象,子类必须实现 用于queryByOrg的通用实现voiddelete(AuthorityRequest entity) voiddeleteByUid(String uid) protected AuthorityEntitydoSave(AuthorityEntity entity) 子类实现具体的保存逻辑protected org.springframework.data.domain.Page<AuthorityEntity>executePageQuery(org.springframework.data.jpa.domain.Specification<AuthorityEntity> spec, org.springframework.data.domain.Pageable pageable) 执行分页查询,子类必须实现 用于queryByOrg的通用实现existsByValue(String value) findByLevelMarker(String levelMarker) findByValue(String value) handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, AuthorityEntity entity) update(AuthorityRequest request) Methods inherited from class com.bytedesk.core.base.BaseRestService
deleteByOrgUid, findByOrgUid, getUidFromRequest, queryByOrg, queryByUid, queryByUser, recover, save, setUserUidToRequest
-
Field Details
-
authorityRepository
-
modelMapper
private final org.modelmapper.ModelMapper modelMapper -
uidUtils
-
-
Constructor Details
-
AuthorityRestService
public AuthorityRestService()
-
-
Method Details
-
findByUid
@Cacheable(value="authority", key="#uid", unless="#result==null") public Optional<AuthorityEntity> findByUid(String uid) - Specified by:
findByUidin classBaseRestService<AuthorityEntity,AuthorityRequest, AuthorityResponse>
-
findByValue
@Cacheable(value="authority", key="#value", unless="#result == null") public Optional<AuthorityEntity> findByValue(String value) -
existsByValue
-
create
- Specified by:
createin classBaseRestService<AuthorityEntity,AuthorityRequest, AuthorityResponse>
-
update
- Specified by:
updatein classBaseRestService<AuthorityEntity,AuthorityRequest, AuthorityResponse>
-
doSave
Description copied from class:BaseRestService子类实现具体的保存逻辑- Specified by:
doSavein classBaseRestService<AuthorityEntity,AuthorityRequest, AuthorityResponse>
-
handleOptimisticLockingFailureException
public AuthorityEntity handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, AuthorityEntity entity) - Specified by:
handleOptimisticLockingFailureExceptionin classBaseRestService<AuthorityEntity,AuthorityRequest, AuthorityResponse>
-
deleteByUid
- Specified by:
deleteByUidin classBaseRestService<AuthorityEntity,AuthorityRequest, AuthorityResponse>
-
delete
- Specified by:
deletein classBaseRestService<AuthorityEntity,AuthorityRequest, AuthorityResponse>
-
convertToResponse
- Specified by:
convertToResponsein classBaseRestService<AuthorityEntity,AuthorityRequest, AuthorityResponse>
-
createSpecification
protected org.springframework.data.jpa.domain.Specification<AuthorityEntity> createSpecification(AuthorityRequest request) Description copied from class:BaseRestService创建Specification对象,子类必须实现 用于queryByOrg的通用实现- Specified by:
createSpecificationin classBaseRestService<AuthorityEntity,AuthorityRequest, AuthorityResponse>
-
executePageQuery
protected org.springframework.data.domain.Page<AuthorityEntity> executePageQuery(org.springframework.data.jpa.domain.Specification<AuthorityEntity> spec, org.springframework.data.domain.Pageable pageable) Description copied from class:BaseRestService执行分页查询,子类必须实现 用于queryByOrg的通用实现- Specified by:
executePageQueryin classBaseRestService<AuthorityEntity,AuthorityRequest, AuthorityResponse>
-
findByLevelMarker
-
findAllActive
-
createForPlatform
创建权限(不再在权限字符串中编码层级) 约定: - SETTINGS_* 为平台级(PLATFORM) - 其余 MODULE_ACTION 默认为组织级(ORGANIZATION) 例如:传入 "TAG_READ" 只会创建: - TAG_READ- Parameters:
permissionValue- 权限值,格式为 "MODULE_ACTION",如 "TAG_READ", "TAG_CREATE"- Returns:
- 平台级权限的响应
-
resetAuthorityLevels
-