use of org.simbasecurity.core.domain.ResourceRuleEntity in project simba-os by cegeka.
the class RuleDTOAssemblerTest method createResourceRule.
private ResourceRule createResourceRule() {
ResourceRuleEntity rule = new ResourceRuleEntity("resource rule name");
rule.setResourceName("resource name");
rule.setCreateAllowed(true);
rule.setDeleteAllowed(true);
rule.setReadAllowed(true);
rule.setWriteAllowed(true);
return rule;
}
use of org.simbasecurity.core.domain.ResourceRuleEntity in project simba-os by cegeka.
the class RuleDatabaseRepositoryTest method canFindAllRulesNotLinkedToAPolicy.
@Test
public void canFindAllRulesNotLinkedToAPolicy() throws Exception {
ResourceRuleEntity notLinkedRule = new ResourceRuleEntity("hipiejipie");
notLinkedRule.setResourceName("hipiejipie");
persistAndRefresh(notLinkedRule);
Policy anotherPolicy = new PolicyEntity("hipiepolicy");
anotherPolicy.addRule(notLinkedRule);
persistAndRefresh(anotherPolicy);
Collection<Rule> rules = ruleDatabaseRepository.findNotLinked(policy);
assertTrue(rules.containsAll(Arrays.asList(notLinkedRule)));
}
use of org.simbasecurity.core.domain.ResourceRuleEntity in project simba-os by cegeka.
the class RuleDatabaseRepositoryTest method setupWithGroups.
private ResourceRule setupWithGroups() {
User user = new UserEntity(USER_VIA_GROUP);
Role role = new RoleEntity("role2");
Group group = new GroupEntity("groupName", "cn");
Policy policy = new PolicyEntity("policy2");
ResourceRule resourceRuleEntity = new ResourceRuleEntity("resrule2");
resourceRuleEntity.setResourceName("resname2");
urlRuleEntityViaGroup = new URLRuleEntity("urlrule2");
persistAndRefresh(user, role, policy, resourceRuleEntity, urlRuleEntityViaGroup);
persistAndRefresh(user, group, role, policy, resourceRuleEntity, urlRuleEntityViaGroup);
policy.addRule(resourceRuleEntity);
policy.addRule(urlRuleEntityViaGroup);
role.addPolicy(policy);
group.addRole(role);
user.addGroup(group);
return resourceRuleEntity;
}
use of org.simbasecurity.core.domain.ResourceRuleEntity in project simba-os by cegeka.
the class RuleDatabaseRepositoryTest method setUp.
@Before
public void setUp() {
UserEntity user = new UserEntity(USER_NAME);
RoleEntity role = new RoleEntity(ROLE_NAME);
policy = new PolicyEntity(POLICY_NAME);
resourceRuleEntity = new ResourceRuleEntity(RESOURCE_RULE_NAME);
resourceRuleEntity.setResourceName(RESOURCE_NAME);
urlRuleEntity = new URLRuleEntity("urlrule");
persistAndRefresh(user, role, policy, resourceRuleEntity, urlRuleEntity);
policy.addRule(resourceRuleEntity);
policy.addRule(urlRuleEntity);
role.addPolicy(policy);
user.addRole(role);
}
Aggregations