Search in sources :

Example 1 with ResourceRuleDTO

use of org.simbasecurity.core.service.manager.dto.ResourceRuleDTO in project simba-os by cegeka.

the class RuleDTOAssemblerTest method testAssembleSingleRule_ResourceRule.

@Test
public void testAssembleSingleRule_ResourceRule() {
    ResourceRule resourceRule = createResourceRule();
    ResourceRuleDTO ruleData = (ResourceRuleDTO) RuleDTOAssembler.assemble(resourceRule);
    assertNotNull(ruleData);
    assertEquals(resourceRule.getName(), ruleData.getName());
    assertEquals(resourceRule.getResourceName(), ruleData.getResourceName());
    assertEquals(true, ruleData.isCreateAllowed());
    assertEquals(true, ruleData.isDeleteAllowed());
    assertEquals(true, ruleData.isReadAllowed());
    assertEquals(true, ruleData.isWriteAllowed());
    assertEquals(0, ruleData.getId());
    assertEquals(0, ruleData.getVersion());
}
Also used : ResourceRule(org.simbasecurity.core.domain.ResourceRule) ResourceRuleDTO(org.simbasecurity.core.service.manager.dto.ResourceRuleDTO) Test(org.junit.Test)

Example 2 with ResourceRuleDTO

use of org.simbasecurity.core.service.manager.dto.ResourceRuleDTO in project simba-os by cegeka.

the class RuleDTOAssembler method assemble.

public static RuleDTO assemble(final ResourceRule rule) {
    final ResourceRuleDTO ruleDTO = new ResourceRuleDTO();
    applyVersionAndId((AbstractVersionedEntity) rule, ruleDTO);
    applyRuleDTOAssembling(rule, ruleDTO);
    ruleDTO.setCreateAllowed(rule.isCreateAllowed());
    ruleDTO.setDeleteAllowed(rule.isDeleteAllowed());
    ruleDTO.setReadAllowed(rule.isReadAllowed());
    ruleDTO.setWriteAllowed(rule.isWriteAllowed());
    return ruleDTO;
}
Also used : ResourceRuleDTO(org.simbasecurity.core.service.manager.dto.ResourceRuleDTO)

Aggregations

ResourceRuleDTO (org.simbasecurity.core.service.manager.dto.ResourceRuleDTO)2 Test (org.junit.Test)1 ResourceRule (org.simbasecurity.core.domain.ResourceRule)1