Search in sources :

Example 11 with Operator

use of eu.ggnet.dwoss.rights.ee.entity.Operator in project dwoss by gg-net.

the class PersonaOperatorIT method testDuplicateRemoval.

/**
 * Test, that duplicate Rights to Persona and Operator are only keept on the persona.
 */
@Test
public void testDuplicateRemoval() {
    assertThat(agent).as("RightsAgent").isNotNull();
    Operator op = new Operator("TestUser");
    Persona p = new Persona("Testpersona");
    p.add(CREATE_ANNULATION_INVOICE);
    p = agent.store(p);
    op.add(p);
    op = agent.store(op);
    // Now we have one operator with one persona with one right.
    // adding the same right to the operator
    op.add(CREATE_ANNULATION_INVOICE);
    // This should clear the duplicated right.
    op = agent.store(op);
    assertThat(op.getRights()).describedAs("The Operator, that should not have any right, cause its duplicate of the persona.").doesNotContain(CREATE_ANNULATION_INVOICE);
}
Also used : Operator(eu.ggnet.dwoss.rights.ee.entity.Operator) Persona(eu.ggnet.dwoss.rights.ee.entity.Persona) Test(org.junit.Test)

Example 12 with Operator

use of eu.ggnet.dwoss.rights.ee.entity.Operator in project dwoss by gg-net.

the class RightsManagmentController method resetDeactiveRights.

private void resetDeactiveRights() {
    Operator op = userlist.getSelectionModel().getSelectedItem();
    deactivatedRightsList.clear();
    deactivatedRightsList.addAll(EnumSet.complementOf(op.getAllActiveRights()));
}
Also used : Operator(eu.ggnet.dwoss.rights.ee.entity.Operator)

Example 13 with Operator

use of eu.ggnet.dwoss.rights.ee.entity.Operator in project dwoss by gg-net.

the class RightsManagmentController method handleRemoveRightButton.

@FXML
private void handleRemoveRightButton() {
    Operator op = userlist.getSelectionModel().getSelectedItem();
    List<AtomicRight> selectedItems = new ArrayList<>(activeRights.getSelectionModel().getSelectedItems());
    selectedOperator().removeAllRight(selectedItems);
    resetDeactiveRights();
    resetAllRights();
    // setSelectedOperator(op);
    Dl.remote().lookup(RightsAgent.class).store(op);
}
Also used : Operator(eu.ggnet.dwoss.rights.ee.entity.Operator) AtomicRight(eu.ggnet.dwoss.rights.api.AtomicRight) RightsAgent(eu.ggnet.dwoss.rights.ee.RightsAgent)

Example 14 with Operator

use of eu.ggnet.dwoss.rights.ee.entity.Operator in project dwoss by gg-net.

the class RightsAgentStub method make.

public Operator make(String username, Collection<AtomicRight> activeRights) {
    Operator o = new Operator();
    o.setUsername(username);
    for (AtomicRight right : activeRights) {
        o.add(right);
    }
    return o;
}
Also used : Operator(eu.ggnet.dwoss.rights.ee.entity.Operator) AtomicRight(eu.ggnet.dwoss.rights.api.AtomicRight)

Aggregations

Operator (eu.ggnet.dwoss.rights.ee.entity.Operator)14 AtomicRight (eu.ggnet.dwoss.rights.api.AtomicRight)5 RightsAgent (eu.ggnet.dwoss.rights.ee.RightsAgent)4 Persona (eu.ggnet.dwoss.rights.ee.entity.Persona)4 UserInfoException (eu.ggnet.dwoss.util.UserInfoException)2 Test (org.junit.Test)2 OperatorEao (eu.ggnet.dwoss.rights.ee.eao.OperatorEao)1 MouseEvent (javafx.scene.input.MouseEvent)1