Package org.cyclos.security.users
Class RecordServiceSecurity
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.security.BaseServiceSecurity
-
- org.cyclos.security.CRUDServiceSecurity<RecordDTO,Record,RecordData,RecordDataParams>
-
- org.cyclos.security.users.RecordServiceSecurity
-
- All Implemented Interfaces:
CRUDService<RecordDTO,RecordData,RecordDataParams>,CRUDWithConfirmationPasswordService<RecordDTO,RecordData,RecordDataParams>,Service,RecordService
@Security public class RecordServiceSecurity extends CRUDServiceSecurity<RecordDTO,Record,RecordData,RecordDataParams> implements RecordService
Security layer forRecordService
-
-
Field Summary
-
Fields inherited from class org.cyclos.security.CRUDServiceSecurity
entityClass
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, customFieldValueHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description RecordServiceSecurity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanPerformOperation(Record record, CRUDOperation operation)Returns whether the logged user can perform the given operation over the given entity<T extends RecordType>
booleancanPerformOperation(T type, User user, CRUDOperation operation)protected voidcheckCreateNew(RecordDataParams params)Checks whether creating new entities with the given context parameters is allowed, throwingPermissionDeniedExceptionif notprotected voidcheckSharedFieldsSearchPermissions()booleandoHasManageAccess(Record record)Should be implemented in order to return whether the caller is allowed to manage the given entity, for the given operationbooleandoHasViewAccess(Record record)Should be implemented in order to return whether the caller is allowed to view the given entity.FileInfoexportRecords(@NotNull ExportFormatVO format, @NotNull RecordQuery query)Generates a file with the query resultprotected RecordServiceLocalgetImplementation()Should be implemented in order to return the actual implementation of the serviceList<RecordTypeCountVO>getRecordTypeCount(InternalAccountOwner owner)Returns, for each visible record type, the count and permissions over records of the given owner (either system or user)RecordSearchDatagetSearchData(RecordTypeVO recordTypeVO, UserLocatorVO locator)Returns data for searching records, if the given locator is null it returns system record dataSharedRecordFieldsSearchDatagetSharedFieldsSearchData()Returns data for searching records with shared record fieldsTiledRecordsDatagetTiledRecordsData(RecordTypeVO recordTypeVO, UserLocatorVO locator)Returns data for listing tiled records of a given user or systembooleanisAccessible(SessionData sessionData, Record entity)Must be implemented in order to determine whether the given entity is accessible for the given session data.RecordVOloadVO(Long id)Loads a VO, by idprotected voidonBeforeSave(RecordDTO dto, Record entity)Page<RecordVO>search(RecordQuery query)Searches for records-
Methods inherited from class org.cyclos.security.CRUDServiceSecurity
canViewData, checkManageAccess, checkOperation, checkSave, checkViewAccess, customizeData, find, getConfirmationPasswordInputForRemove, getData, getDataForNew, getEntityClass, hasManageAccess, hasViewAccess, load, remove, removeAll, removeAllWithConfirmationPassword, removeWithConfirmationPassword, resolveEntityCheck, save, saveWithConfirmationPassword
-
Methods inherited from class org.cyclos.security.BaseServiceSecurity
checkGuest, checkId, checkIds, checkInternalName, checkLoggedIn, checkManagesUser, checkRelatesToUser, checkScope, checkVO, checkVOs, doInitialize, getEntityCheckRegistry, getUser, initialize
-
Methods inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
canManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getBaseEntityManagerHandler, getConfiguration, getLoggedBasicUser, getLoggedUser, getProducts, getTranslatedName, getTranslatedValue, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, message, message, permission, permission, permissionOptionalValue, permissionOptionalValue, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, delete, detach, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.services.CRUDService
getData, getDataForNew, load, remove, removeAll, save
-
-
-
-
Method Detail
-
canPerformOperation
public boolean canPerformOperation(Record record, CRUDOperation operation)
Description copied from class:CRUDServiceSecurityReturns whether the logged user can perform the given operation over the given entity- Overrides:
canPerformOperationin classCRUDServiceSecurity<RecordDTO,Record,RecordData,RecordDataParams>
-
canPerformOperation
public <T extends RecordType> boolean canPerformOperation(T type, User user, CRUDOperation operation)
-
doHasManageAccess
public boolean doHasManageAccess(Record record)
Description copied from class:CRUDServiceSecurityShould be implemented in order to return whether the caller is allowed to manage the given entity, for the given operation- Specified by:
doHasManageAccessin classCRUDServiceSecurity<RecordDTO,Record,RecordData,RecordDataParams>
-
doHasViewAccess
public boolean doHasViewAccess(Record record)
Description copied from class:CRUDServiceSecurityShould be implemented in order to return whether the caller is allowed to view the given entity.- Specified by:
doHasViewAccessin classCRUDServiceSecurity<RecordDTO,Record,RecordData,RecordDataParams>
-
exportRecords
public FileInfo exportRecords(@NotNull @NotNull ExportFormatVO format, @NotNull @NotNull RecordQuery query)
Description copied from interface:RecordServiceGenerates a file with the query result- Specified by:
exportRecordsin interfaceRecordService
-
getRecordTypeCount
public List<RecordTypeCountVO> getRecordTypeCount(InternalAccountOwner owner) throws FrameworkException
Description copied from interface:RecordServiceReturns, for each visible record type, the count and permissions over records of the given owner (either system or user)- Specified by:
getRecordTypeCountin interfaceRecordService- Throws:
FrameworkException
-
getSearchData
public RecordSearchData getSearchData(RecordTypeVO recordTypeVO, UserLocatorVO locator)
Description copied from interface:RecordServiceReturns data for searching records, if the given locator is null it returns system record data- Specified by:
getSearchDatain interfaceRecordService
-
getSharedFieldsSearchData
public SharedRecordFieldsSearchData getSharedFieldsSearchData()
Description copied from interface:RecordServiceReturns data for searching records with shared record fields- Specified by:
getSharedFieldsSearchDatain interfaceRecordService
-
getTiledRecordsData
public TiledRecordsData getTiledRecordsData(RecordTypeVO recordTypeVO, UserLocatorVO locator)
Description copied from interface:RecordServiceReturns data for listing tiled records of a given user or system- Specified by:
getTiledRecordsDatain interfaceRecordService
-
isAccessible
public boolean isAccessible(SessionData sessionData, Record entity)
Description copied from class:CRUDServiceSecurityMust be implemented in order to determine whether the given entity is accessible for the given session data. This method shouldn't check the same condition asCRUDServiceSecurity.hasViewAccess(BaseEntity). If the only condition for an entity isCRUDServiceSecurity.hasViewAccess(BaseEntity), this method should return false.- Specified by:
isAccessiblein classCRUDServiceSecurity<RecordDTO,Record,RecordData,RecordDataParams>
-
loadVO
public RecordVO loadVO(Long id) throws FrameworkException
Description copied from interface:RecordServiceLoads a VO, by id- Specified by:
loadVOin interfaceRecordService- Throws:
FrameworkException
-
search
public Page<RecordVO> search(RecordQuery query) throws QueryParseException
Description copied from interface:RecordServiceSearches for records- Specified by:
searchin interfaceRecordService- Throws:
QueryParseException
-
checkCreateNew
protected void checkCreateNew(RecordDataParams params)
Description copied from class:CRUDServiceSecurityChecks whether creating new entities with the given context parameters is allowed, throwingPermissionDeniedExceptionif not- Specified by:
checkCreateNewin classCRUDServiceSecurity<RecordDTO,Record,RecordData,RecordDataParams>
-
checkSharedFieldsSearchPermissions
protected void checkSharedFieldsSearchPermissions()
-
getImplementation
protected RecordServiceLocal getImplementation()
Description copied from class:CRUDServiceSecurityShould be implemented in order to return the actual implementation of the service- Specified by:
getImplementationin classCRUDServiceSecurity<RecordDTO,Record,RecordData,RecordDataParams>
-
onBeforeSave
protected void onBeforeSave(RecordDTO dto, Record entity)
- Overrides:
onBeforeSavein classCRUDServiceSecurity<RecordDTO,Record,RecordData,RecordDataParams>
-
-