Package org.structr.core.entity

Examples of org.structr.core.entity.TestUser


    clearResourceAccess();

    try {

      List<TestUser> users = createTestNodes(TestUser.class, 1);
      TestUser user = (TestUser) users.get(0);

      // Create node with user context
      Class type = TestOne.class;
      TestOne t1 = createTestNode(TestOne.class, user);
View Full Code Here


    clearResourceAccess();

    try {

      List<TestUser> users = createTestNodes(TestUser.class, 1);
      TestUser user = (TestUser) users.get(0);

      PropertyMap props = new PropertyMap();
      props.put(AbstractNode.visibleToPublicUsers, true);

      // Create two nodes with user context, one of them is visible to public users
View Full Code Here

    clearResourceAccess();

    try {

      List<TestUser> users = createTestNodes(TestUser.class, 1);
      TestUser user = (TestUser) users.get(0);

      PropertyMap props = new PropertyMap();
      props.put(AbstractNode.visibleToPublicUsers, true);

      // Create two nodes with user context, one of them is visible to public users
View Full Code Here

    clearResourceAccess();

    try {

      List<TestUser> users = createTestNodes(TestUser.class, 2);
      TestUser user1 = (TestUser) users.get(0);
      TestUser user2 = (TestUser) users.get(1);

      PropertyMap props = new PropertyMap();
      props.put(AbstractNode.visibleToPublicUsers, true);

      // Create two nodes with user context, one of them is visible to public users
View Full Code Here

    clearResourceAccess();

    try {

      List<TestUser> users = createTestNodes(TestUser.class, 2);
      TestUser user1 = (TestUser) users.get(0);
      TestUser user2 = (TestUser) users.get(1);

      PropertyMap props = new PropertyMap();
      props.put(AbstractNode.visibleToPublicUsers, true);

      // Create two nodes with user context, one of them is visible to public users
View Full Code Here

    clearResourceAccess();

    try {

      List<TestUser> users = createTestNodes(TestUser.class, 2);
      TestUser user1 = (TestUser) users.get(0);
      TestUser user2 = (TestUser) users.get(1);
      Result result = null;

      // Let user 1 create a node
      Class type = TestOne.class;
      final TestOne t1 = createTestNode(TestOne.class, user1);

      try (final Tx tx = app.tx()) {

        // Grant read permission to user 2
        user2.grant(Permission.read, t1);
        tx.success();
      }

      // Let user 2 search
      SecurityContext user2Context = SecurityContext.getInstance(user2, AccessMode.Backend);

      try (final Tx tx = app.tx()) {

        result = StructrApp.getInstance(user2Context).nodeQuery(type).getResult();

        assertEquals(1, result.size());
        assertEquals(t1.getUuid(), result.get(0).getUuid());
      }

      try (final Tx tx = app.tx()) {

        // Revoke permission again
        user2.revoke(Permission.read, t1);
        tx.success();
      }

      try (final Tx tx = app.tx()) {
View Full Code Here

  public void test01SetOwner() {

    try {
   
      TestUser user1 = null;
      TestUser user2 = null;
      TestOne t1 = null;
      Class type = TestOne.class;

      final App superUserApp = StructrApp.getInstance();
      try (final Tx tx = app.tx()) {

        List<TestUser> users = createTestNodes(TestUser.class, 2);
        user1 = (TestUser) users.get(0);
        user1.setProperty(AbstractNode.name, "user1");
       
        user2 = (TestUser) users.get(1);
        user2.setProperty(AbstractNode.name, "user2");

        t1 = createTestNode(TestOne.class);

        t1.setProperty(AbstractNode.owner, user1);
View Full Code Here

    final App superUserApp = StructrApp.getInstance();
   
    try (final Tx tx = app.tx()) {

      List<TestUser> users = createTestNodes(TestUser.class, 2);
      TestUser user1 = (TestUser) users.get(0);

      List<Group> groups = createTestNodes(Group.class, 1);
      Group group1 = (Group) groups.get(0);
     
      TestOne t1 = createTestNode(TestOne.class);
View Full Code Here

 
  public void testCallbacksWithNormalContext() {
   
    try {
     
      TestUser person = this.createTestNode(TestUser.class);
     
      final SecurityContext securityContext = SecurityContext.getInstance(person, null, AccessMode.Backend);
      testCallbacks(securityContext);
     
    } catch (FrameworkException fex) {
View Full Code Here

TOP

Related Classes of org.structr.core.entity.TestUser

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.