Package org.intalio.tempo.workflow.auth

Examples of org.intalio.tempo.workflow.auth.UserRoles


        permissions.put(TaskPermissions.ACTION_DELETE, deletePermissions);
        return new TaskPermissions(permissions);
    }

    public static SimpleAuthProvider getMeASimpleAuthProvider() {
        UserRoles user1 = new UserRoles("test/user1", new String[] { "test/role1", "test/role2" });
        UserRoles user2 = new UserRoles("test/user2", new String[] { "test/role2", "test/role3" });
        UserRoles user3 = new UserRoles("test/user3", new String[] { "test/role4", "test/role5" });
        UserRoles systemUser = new UserRoles("test/system-user", new String[] { "test/role1", "test/role2","test/role3", "examples/employee", "*/*"});

        SimpleAuthProvider authProvider = new SimpleAuthProvider();
        authProvider.addUserToken("token1", user1);
        authProvider.addUserToken("token2", user2);
        authProvider.addUserToken("token3", user3);
View Full Code Here


      createPerms.add("just\\me");
      permissions.put("create", createPerms);
     
      TaskPermissions tp = new TaskPermissions(permissions);
     
      UserRoles ur = new UserRoles("Matthieu", new AuthIdentifierSet(new String[]{"intalio\\admin", "intalio\\tester"}));
      UserRoles ur2 = new UserRoles("Niko", new AuthIdentifierSet(new String[]{"intalio\\guru"}));
      UserRoles ur3 = new UserRoles("just\\me", new AuthIdentifierSet(new String[]{"intalio\\guru"}));
     
     
      Assert.assertFalse(tp.isAuthorized("create", new PIPATask(), ur));
      Assert.assertTrue(tp.isAuthorized("delete", new PIPATask(), ur));
      Assert.assertFalse(tp.isAuthorized("delete", new PIPATask(), ur2));
View Full Code Here

    public void testN3AuthProvider() throws Exception {
        N3AuthProvider n3 = new N3AuthProvider();
        n3.setWsEndpoint("http://localhost:8080/axis2/services/TokenService");
       
        IAuthProvider provider = n3;
        UserRoles user = provider.authenticate(SYSTEM_TEST_TOKEN);
        Assert.assertEquals("exolab\\castor", user.getUserID());
    }
View Full Code Here

            {
                one(tc).getTokenProperties(SYSTEM_TEST_TOKEN); will(returnValue(properties));
            }
        });
        ap.setWsEndpoint("http://localhost:8080/axis2/services/TokenService");
        UserRoles user = ap.authenticate(SYSTEM_TEST_TOKEN);
        Assert.assertEquals("exolab\\castor", user.getUserID());
    }
View Full Code Here

    public void testAssignClaimAndAvailable() throws Exception {
      PATask task = this.createPATask();
      task.setState(TaskState.READY);
      task.getRoleOwners().add("group");
      task.getUserOwners().add("gregor");
      UserRoles gregor = new UserRoles("gregor", new String[]{"group"});
      UserRoles niko = new UserRoles("niko", new String[]{"group"});
      Assert.assertTrue(task.isAvailableTo(gregor));
      Assert.assertTrue(task.isAvailableTo(niko));
      task.setState(TaskState.CLAIMED);
      Assert.assertTrue(task.isAvailableTo(gregor));
      Assert.assertFalse(task.isAvailableTo(niko));
View Full Code Here

    public static void main(String[] args) {
        junit.textui.TestRunner.run(TaskMarshallerTest.class);
    }

    private void testTaskMarshalling(Task task) throws Exception {
        _logger.debug(TestUtils.toPrettyXML(new TaskMarshaller().marshalFullTask(task, new UserRoles("testUser", new String[]{}))));
    }
View Full Code Here

                String roles = "";
                for (int i = 0; i < invokerRoles.length; i++)
                    roles += (i == 0 ? "" : ",") + invokerRoles[i];
                _logger.debug("User " + invokerUser + " with roles " + roles);
            }
            return new UserRoles(invokerUser, invokerRoles);
        } catch (Exception e) {
            throw new AuthException(e);
        }
    }
View Full Code Here

  }

  private void testRange(int first, int max, int expected) {
    TaskFetcher taskFetcher = new TaskFetcher(factory.createEntityManager());
    HashMap map = new HashMap();
    map.put(TaskFetcher.FETCH_USER, new UserRoles("user1",
        new String[] { "examples\\employee" }));
    map.put(TaskFetcher.FETCH_CLASS, PATask.class);
    map.put(TaskFetcher.FETCH_SUB_QUERY, "");
    map.put(TaskFetcher.FETCH_FIRST, first);
    map.put(TaskFetcher.FETCH_MAX, max);
View Full Code Here

  }

  private void testCount(long expected) throws Exception {
    final TaskFetcher taskFetcher = new TaskFetcher(em);
    HashMap map = new HashMap();
    map.put(TaskFetcher.FETCH_USER, new UserRoles("user1",
        new String[] { "examples\\employee" }));
    map.put(TaskFetcher.FETCH_CLASS, PATask.class);
    Assert
        .assertEquals((Long) expected, (Long) taskFetcher
            .countTasks(map));
View Full Code Here

    task1.getUserOwners().add(user);
    persist(task1);

    for (String us : users) {
      _logger.info(user + ":" + us + ":");
      UserRoles ur = new UserRoles(us, new String[] {});
      Task[] tasks = new TaskFetcher(em).fetchAllAvailableTasks(ur);
      if (tasks.length > 0)
        Assert.assertEquals(tasks[0].isAvailableTo(ur), true);
    }
View Full Code Here

TOP

Related Classes of org.intalio.tempo.workflow.auth.UserRoles

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.