Examples of AclEntry


Examples of com.ecyrd.jspwiki.auth.acl.AclEntry

        Principal uBob = new WikiPrincipal( "Bob" );
        Principal uCharlie = new WikiPrincipal( "Charlie" );
        Principal uDave = new WikiPrincipal( "Dave" );

        //  Alice can view
        AclEntry ae = new AclEntryImpl();
        ae.addPermission( PagePermission.VIEW );
        ae.setPrincipal( uAlice );

        //  Charlie can view
        AclEntry ae2 = new AclEntryImpl();
        ae2.addPermission( PagePermission.VIEW );
        ae2.setPrincipal( uCharlie );

        //  Bob can view and edit (and by implication, comment)
        AclEntry ae3 = new AclEntryImpl();
        ae3.addPermission( PagePermission.VIEW );
        ae3.addPermission( PagePermission.EDIT );
        ae3.setPrincipal( uBob );

        // Dave can view and comment
        AclEntry ae4 = new AclEntryImpl();
        ae4.addPermission( PagePermission.VIEW );
        ae4.addPermission( PagePermission.COMMENT );
        ae4.setPrincipal( uDave );

        // Create ACL with Alice, Bob, Charlie, Dave
        m_acl.addEntry( ae );
        m_acl.addEntry( ae2 );
        m_acl.addEntry( ae3 );
        m_acl.addEntry( ae4 );

        // Foo group includes Alice and Bob
        Group foo = m_groupMgr.parseGroup( "FooGroup", "", true );
        m_groupMgr.setGroup( m_session, foo );
        foo.add( uAlice );
        foo.add( uBob );
        AclEntry ag1 = new AclEntryImpl();
        ag1.setPrincipal( foo.getPrincipal() );
        ag1.addPermission( PagePermission.EDIT );
        m_aclGroup.addEntry( ag1 );
        m_groups.put( "FooGroup", foo );

        // Bar group includes Bob and Charlie
        Group bar = m_groupMgr.parseGroup( "BarGroup", "", true );
        m_groupMgr.setGroup( m_session, bar );
        bar.add( uBob );
        bar.add( uCharlie );
        AclEntry ag2 = new AclEntryImpl();
        ag2.setPrincipal( bar.getPrincipal() );
        ag2.addPermission( PagePermission.VIEW );
        m_aclGroup.addEntry( ag2 );
        m_groups.put( "BarGroup", bar );
    }
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.acl.AclEntry

            Enumeration entries = acl.entries();
            Collection<AclEntry> entriesToAdd    = new ArrayList<AclEntry>();
            Collection<AclEntry> entriesToRemove = new ArrayList<AclEntry>();
            while ( entries.hasMoreElements() )
            {
                AclEntry entry = (AclEntry)entries.nextElement();
                if ( ArrayUtils.contains( oldPrincipals, entry.getPrincipal() ) )
                {
                    // Create new entry
                    AclEntry newEntry = new AclEntryImpl();
                    newEntry.setPrincipal( newPrincipal );
                    Enumeration permissions = entry.permissions();
                    while ( permissions.hasMoreElements() )
                    {
                        Permission permission = (Permission)permissions.nextElement();
                        newEntry.addPermission(permission);
                    }
                    pageChanged = true;
                    entriesToRemove.add( entry );
                    entriesToAdd.add( newEntry );
                }
            }
            for ( Iterator ix = entriesToRemove.iterator(); ix.hasNext(); )
            {
                AclEntry entry = (AclEntry)ix.next();
                acl.removeEntry( entry );
            }
            for ( Iterator ix = entriesToAdd.iterator(); ix.hasNext(); )
            {
                AclEntry entry = (AclEntry)ix.next();
                acl.addEntry( entry );
            }
        }
        return pageChanged;
    }
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.acl.AclEntry

        {
            p.m_accessList = new AclImpl();
           
            for( Enumeration entries = m_accessList.entries(); entries.hasMoreElements(); )
            {
                AclEntry e = (AclEntry)entries.nextElement();
           
                p.m_accessList.addEntry( e );
            }
        }
           
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.acl.AclEntry

        if( acl != null )
        {
            ArrayList<String> propval = new ArrayList<String>();
            for( Enumeration<AclEntry> ee = acl.entries(); ee.hasMoreElements(); )
            {
                AclEntry ae = ee.nextElement();
               
                StringBuilder sb = new StringBuilder();
               
                sb.append("ALLOW \"");
                sb.append(ae.getPrincipal().getName());
                sb.append("\" ");
               
                for( Enumeration<Permission> permissions = ae.permissions(); permissions.hasMoreElements(); )
                {
                    Permission perm = permissions.nextElement();
                   
                    sb.append( perm.getActions() );
                    sb.append( "," );
View Full Code Here

Examples of com.ecyrd.jspwiki.auth.acl.AclEntry

        {
            // If the ACL principal we're looking at is unresolved,
            // try to resolve it here & correct the Acl
            if ( aclPrincipal instanceof UnresolvedPrincipal )
            {
                AclEntry aclEntry = acl.getEntry( aclPrincipal );
                aclPrincipal = resolvePrincipal( aclPrincipal.getName() );
                if ( aclEntry != null && !( aclPrincipal instanceof UnresolvedPrincipal ) )
                {
                    aclEntry.setPrincipal( aclPrincipal );
                }
            }

            if ( hasRoleOrPrincipal( session, aclPrincipal ) )
            {
View Full Code Here

Examples of com.google.gdata.data.acl.AclEntry

  DocumentListException {
    if (role == null || scope == null || resourceId == null) {
      throw new DocumentListException("null passed in for required parameters");
    }

    AclEntry entry = new AclEntry();
    entry.setRole(role);
    entry.setScope(scope);
    URL url = buildUrl(URL_DEFAULT + URL_DOCLIST_FEED + "/" + resourceId + URL_ACL);

    return service.insert(url, entry);
  }
View Full Code Here

Examples of com.google.gdata.data.acl.AclEntry

    }

    //This request makes our previously uploaded document public
    AclScope scope = new AclScope(AclScope.Type.DOMAIN,uploadedExcelDocumentID);

    AclEntry aclEntry = demo.addAclRole(AclRole.READER, scope,  uploadedExcelDocumentID);
    assertNotNull("aclEntry should not be null",aclEntry);

  }
View Full Code Here

Examples of com.google.gdata.data.acl.AclEntry

            foundEntries = true;
          }
        }
      }
      if (foundEntries == false) {
        AclEntry aclEntry = new AclEntry();
        aclEntry.setRole(new AclRole("reader"));
        aclEntry.setScope(scope);
        documentsService.insert(new URL(entry.getAclFeedLink().getHref()), aclEntry);
      }
    } catch (MalformedURLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

Examples of com.google.gdata.data.acl.AclEntry

  }

  public void addAclRole(DocumentListEntry entry, String user, String role) {
    if (Strings.isValidDomainAccount(user, "gmail.com") || Strings.isValidDomainAccount(user, "casamind.com")) {
      try {
        AclEntry aclEntry = new AclEntry();
        aclEntry.setRole(new AclRole(role));
        aclEntry.setScope(new AclScope(AclScope.Type.USER, user));
        documentsService.insert(new URL(entry.getAclFeedLink().getHref()), aclEntry);
      } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (IOException e) {
View Full Code Here

Examples of com.volantis.shared.security.acl.ACLEntry

        if (map != null) {
            for (Iterator i = map.entrySet().iterator(); i.hasNext();) {
                Map.Entry entry = (Map.Entry) i.next();
                Group group = (Group) entry.getKey();
                if (group.isMember(principal)) {
                    ACLEntry aclEntry = (ACLEntry) entry.getValue();
                    permissions = updatePermissions(permissions, aclEntry);
                }
            }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.