Search in sources :

Example 6 with SecurityQuestion

use of org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion in project syncope by apache.

the class SecurityQuestionTest method save.

@Test
public void save() {
    SecurityQuestion securityQuestion = entityFactory.newEntity(SecurityQuestion.class);
    securityQuestion.setContent("What is your favorite pet's name?");
    SecurityQuestion actual = securityQuestionDAO.save(securityQuestion);
    assertNotNull(actual);
    assertNotNull(actual.getKey());
}
Also used : SecurityQuestion(org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion) Test(org.junit.jupiter.api.Test) AbstractTest(org.apache.syncope.core.persistence.jpa.AbstractTest)

Example 7 with SecurityQuestion

use of org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion in project syncope by apache.

the class SecurityQuestionLogic method delete.

@PreAuthorize("hasRole('" + StandardEntitlement.SECURITY_QUESTION_DELETE + "')")
public SecurityQuestionTO delete(final String key) {
    SecurityQuestion securityQuestion = securityQuestionDAO.find(key);
    if (securityQuestion == null) {
        LOG.error("Could not find security question '" + key + "'");
        throw new NotFoundException(String.valueOf(key));
    }
    SecurityQuestionTO deleted = binder.getSecurityQuestionTO(securityQuestion);
    securityQuestionDAO.delete(key);
    return deleted;
}
Also used : NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) SecurityQuestion(org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion) SecurityQuestionTO(org.apache.syncope.common.lib.to.SecurityQuestionTO) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Example 8 with SecurityQuestion

use of org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion in project syncope by apache.

the class SecurityQuestionTest method find.

@Test
public void find() {
    SecurityQuestion securityQuestion = securityQuestionDAO.find("887028ea-66fc-41e7-b397-620d7ea6dfbb");
    assertNotNull(securityQuestion);
    assertNotNull(securityQuestion.getContent());
}
Also used : SecurityQuestion(org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion) Test(org.junit.jupiter.api.Test) AbstractTest(org.apache.syncope.core.persistence.jpa.AbstractTest)

Aggregations

SecurityQuestion (org.apache.syncope.core.persistence.api.entity.user.SecurityQuestion)8 SyncopeClientCompositeException (org.apache.syncope.common.lib.SyncopeClientCompositeException)2 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)2 AnyUtils (org.apache.syncope.core.persistence.api.entity.AnyUtils)2 Realm (org.apache.syncope.core.persistence.api.entity.Realm)2 RelationshipType (org.apache.syncope.core.persistence.api.entity.RelationshipType)2 Role (org.apache.syncope.core.persistence.api.entity.Role)2 AnyObject (org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject)2 Group (org.apache.syncope.core.persistence.api.entity.group.Group)2 UMembership (org.apache.syncope.core.persistence.api.entity.user.UMembership)2 URelationship (org.apache.syncope.core.persistence.api.entity.user.URelationship)2 User (org.apache.syncope.core.persistence.api.entity.user.User)2 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1