Package org.cyclos.security.users
Class PhoneServiceSecurity
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.security.BaseServiceSecurity
-
- org.cyclos.security.CRUDServiceSecurity<PhoneDTO,Phone,PhoneData,PhoneDataParams>
-
- org.cyclos.security.users.PhoneServiceSecurity
-
- All Implemented Interfaces:
CRUDService<PhoneDTO,PhoneData,PhoneDataParams>,CRUDWithConfirmationPasswordService<PhoneDTO,PhoneData,PhoneDataParams>,Service,PhoneService
@Security public class PhoneServiceSecurity extends CRUDServiceSecurity<PhoneDTO,Phone,PhoneData,PhoneDataParams> implements PhoneService
Security layer forPhoneService
-
-
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, transactionHandler, translationHandler
-
-
Constructor Summary
Constructors Constructor Description PhoneServiceSecurity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanPerformOperation(Phone entity, CRUDOperation operation)Returns whether the logged user can perform the given operation over the given entityprotected voidcheckCreateNew(PhoneDataParams params)Checks whether creating new entities with the given context parameters is allowed, throwingPermissionDeniedExceptionif notvoiddisableForSms(Long id, String confirmationPassword)Disables the given mobile phone to operate via SMSbooleandoHasManageAccess(Phone phone)Should be implemented in order to return whether the caller is allowed to manage the given entity, for the given operationbooleandoHasViewAccess(Phone phone)Should be implemented in order to return whether the caller is allowed to view the given entity.voidenableForSms(Long id)Enables the given mobile phone to operate via SMSPasswordInputDTOgetConfirmationPasswordInputForDisableSms(Long id)Returns data for the confirmation password needed to disable a phone by smsprotected PhoneServiceLocalgetImplementation()Should be implemented in order to return the actual implementation of the servicePhoneListDatagetPhoneListData(UserLocatorVO locator)Returns data containing all phones belonging to the given userbooleanisAccessible(SessionData sessionData, Phone entity)Must be implemented in order to determine whether the given entity is accessible for the given session data.PhoneVOloadByNumber(String number)Returns a mobile phone by number, making sure it is visibleprotected voidonBeforeSave(PhoneDTO dto, Phone phone)StringsendVerificationCode(Long id)Sends a verification code to a mobile phone via SMS.CodeVerificationStatusverify(Long id, String verificationCode)Verifies a mobile phone with a code received via SMS.-
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
-
Methods inherited from interface org.cyclos.services.CRUDWithConfirmationPasswordService
getConfirmationPasswordInputForRemove, removeAllWithConfirmationPassword, removeWithConfirmationPassword, saveWithConfirmationPassword
-
-
-
-
Method Detail
-
canPerformOperation
public boolean canPerformOperation(Phone entity, CRUDOperation operation)
Description copied from class:CRUDServiceSecurityReturns whether the logged user can perform the given operation over the given entity- Overrides:
canPerformOperationin classCRUDServiceSecurity<PhoneDTO,Phone,PhoneData,PhoneDataParams>
-
disableForSms
public void disableForSms(Long id, String confirmationPassword) throws FrameworkException
Description copied from interface:PhoneServiceDisables the given mobile phone to operate via SMS- Specified by:
disableForSmsin interfacePhoneService- Throws:
FrameworkException
-
doHasManageAccess
public boolean doHasManageAccess(Phone phone)
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<PhoneDTO,Phone,PhoneData,PhoneDataParams>
-
doHasViewAccess
public boolean doHasViewAccess(Phone phone)
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<PhoneDTO,Phone,PhoneData,PhoneDataParams>
-
enableForSms
public void enableForSms(Long id) throws FrameworkException
Description copied from interface:PhoneServiceEnables the given mobile phone to operate via SMS- Specified by:
enableForSmsin interfacePhoneService- Throws:
FrameworkException
-
getConfirmationPasswordInputForDisableSms
public PasswordInputDTO getConfirmationPasswordInputForDisableSms(Long id) throws FrameworkException
Description copied from interface:PhoneServiceReturns data for the confirmation password needed to disable a phone by sms- Specified by:
getConfirmationPasswordInputForDisableSmsin interfacePhoneService- Throws:
FrameworkException
-
getPhoneListData
public PhoneListData getPhoneListData(UserLocatorVO locator)
Description copied from interface:PhoneServiceReturns data containing all phones belonging to the given user- Specified by:
getPhoneListDatain interfacePhoneService
-
isAccessible
public boolean isAccessible(SessionData sessionData, Phone 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<PhoneDTO,Phone,PhoneData,PhoneDataParams>
-
loadByNumber
public PhoneVO loadByNumber(String number) throws FrameworkException
Description copied from interface:PhoneServiceReturns a mobile phone by number, making sure it is visible- Specified by:
loadByNumberin interfacePhoneService- Throws:
FrameworkException
-
sendVerificationCode
public String sendVerificationCode(Long id) throws FrameworkException
Description copied from interface:PhoneServiceSends a verification code to a mobile phone via SMS. The phone number is returned.- Specified by:
sendVerificationCodein interfacePhoneService- Throws:
SmsSendingException- If the SMS message couldn't be sendIllegalActionException- If the mobile phone is already verifiedFrameworkException
-
verify
public CodeVerificationStatus verify(Long id, String verificationCode) throws FrameworkException
Description copied from interface:PhoneServiceVerifies a mobile phone with a code received via SMS.- Specified by:
verifyin interfacePhoneService- Throws:
FrameworkException
-
checkCreateNew
protected void checkCreateNew(PhoneDataParams params)
Description copied from class:CRUDServiceSecurityChecks whether creating new entities with the given context parameters is allowed, throwingPermissionDeniedExceptionif not- Specified by:
checkCreateNewin classCRUDServiceSecurity<PhoneDTO,Phone,PhoneData,PhoneDataParams>
-
getImplementation
protected PhoneServiceLocal getImplementation()
Description copied from class:CRUDServiceSecurityShould be implemented in order to return the actual implementation of the service- Specified by:
getImplementationin classCRUDServiceSecurity<PhoneDTO,Phone,PhoneData,PhoneDataParams>
-
onBeforeSave
protected void onBeforeSave(PhoneDTO dto, Phone phone)
- Overrides:
onBeforeSavein classCRUDServiceSecurity<PhoneDTO,Phone,PhoneData,PhoneDataParams>
-
-