Package org.cyclos.security
Class SimpleCRUDServiceSecurity<DTO extends EntityDTO,E extends BaseEntity,D extends EntityData<DTO>,DP>
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.security.BaseServiceSecurity
-
- org.cyclos.security.CRUDServiceSecurity<DTO,E,D,DP>
-
- org.cyclos.security.SimpleCRUDServiceSecurity<DTO,E,D,DP>
-
- All Implemented Interfaces:
CRUDService<DTO,D,DP>,CRUDWithConfirmationPasswordService<DTO,D,DP>,Service
- Direct Known Subclasses:
AuthorizationLevelServiceSecurity,SystemReportPreferencesServiceSecurity
public abstract class SimpleCRUDServiceSecurity<DTO extends EntityDTO,E extends BaseEntity,D extends EntityData<DTO>,DP> extends CRUDServiceSecurity<DTO,E,D,DP>
Simple CRUD security layer, using 2 permissions: one for view and another one for manage
-
-
Field Summary
Fields Modifier and Type Field Description protected PermissionmanagePermissionprotected PermissionviewPermission-
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 SimpleCRUDServiceSecurity(Class<E> entityClass, Permission viewPermission, Permission managePermission)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckCreateNew(DP params)Checks whether creating new entities with the given context parameters is allowed, throwingPermissionDeniedExceptionif notprotected voidcheckManagePermission()Checks whether the caller has the manage permission grantedprotected voidcheckViewPermission()Checks whether the caller has the view permission grantedbooleandoHasManageAccess(E entity)Returns whether the caller has the the manage permission, if anybooleandoHasViewAccess(E entity)Returns whether the caller has the the view permission, if anyprotected booleanhasManagePermission()Returns whether the caller has the manage permission grantedprotected booleanhasViewPermission()Returns whether the caller has the view permission granted-
Methods inherited from class org.cyclos.security.CRUDServiceSecurity
canPerformOperation, canViewData, checkManageAccess, checkOperation, checkSave, checkViewAccess, customizeData, find, getConfirmationPasswordInputForRemove, getData, getDataForNew, getEntityClass, getImplementation, hasManageAccess, hasViewAccess, isAccessible, load, onBeforeSave, 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, setAlreadyValidated, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Field Detail
-
viewPermission
protected final Permission viewPermission
-
managePermission
protected final Permission managePermission
-
-
Constructor Detail
-
SimpleCRUDServiceSecurity
public SimpleCRUDServiceSecurity(Class<E> entityClass, Permission viewPermission, Permission managePermission)
-
-
Method Detail
-
doHasManageAccess
public final boolean doHasManageAccess(E entity)
Returns whether the caller has the the manage permission, if any- Specified by:
doHasManageAccessin classCRUDServiceSecurity<DTO extends EntityDTO,E extends BaseEntity,D extends EntityData<DTO>,DP>
-
doHasViewAccess
public final boolean doHasViewAccess(E entity)
Returns whether the caller has the the view permission, if any- Specified by:
doHasViewAccessin classCRUDServiceSecurity<DTO extends EntityDTO,E extends BaseEntity,D extends EntityData<DTO>,DP>
-
checkCreateNew
protected final void checkCreateNew(DP params)
Description copied from class:CRUDServiceSecurityChecks whether creating new entities with the given context parameters is allowed, throwingPermissionDeniedExceptionif not- Specified by:
checkCreateNewin classCRUDServiceSecurity<DTO extends EntityDTO,E extends BaseEntity,D extends EntityData<DTO>,DP>
-
checkManagePermission
protected final void checkManagePermission() throws PermissionDeniedExceptionChecks whether the caller has the manage permission granted- Throws:
PermissionDeniedException
-
checkViewPermission
protected final void checkViewPermission() throws PermissionDeniedExceptionChecks whether the caller has the view permission granted- Throws:
PermissionDeniedException
-
hasManagePermission
protected final boolean hasManagePermission()
Returns whether the caller has the manage permission granted
-
hasViewPermission
protected final boolean hasViewPermission()
Returns whether the caller has the view permission granted
-
-