Package org.apache.roller.weblogger.webservices.adminprotocol.sdk

Examples of org.apache.roller.weblogger.webservices.adminprotocol.sdk.MemberEntry$Permissions


  public void testGetId() throws RepositoryException {
    assertEquals("{" + TestConnection.docId1 + "}", fd.get_Id().toString());
  }

  public void testGetPermissions() throws RepositoryException {
    Permissions perms = new Permissions(fd.get_Permissions());
    assertNotNull(perms);
    boolean authorized = perms.authorize(MockUtil.createAdministratorUser());
    assertTrue("User is not authorized", authorized);
  }
View Full Code Here


            throw new BadRequestException("ERROR: Cannot put >1 entries per request");
        }
       
        // only one entry
        // if there's zero entries, this is a nop
        MemberEntry entry = (MemberEntry)c.getEntries()[0];
       
        MemberURI muri = (MemberURI)getUri();
       
        // get handle
        // if there's no handle in the entry, set it
        // if the entry and URI handles do not match, exception
        String handle = muri.getHandle();
        if (entry.getHandle() == null) {
            entry.setHandle(handle);
        } else if (!entry.getHandle().equals(handle)) {
            throw new BadRequestException("ERROR: URI and entry handle do not match");
        }
       
        // get username
        // if there's no name in the entry or the URI, exception
        // if there's no name in the entry, set it
        // if the names in the entry and URI do not match, exception
        String username = muri.getUsername();
        if (entry.getName() == null) {
            if (username == null) {
                throw new BadRequestException("ERROR: No user name in URI or entry");
            }
            entry.setName(username);
        } else if (username != null && !entry.getName().equals(username)) {
            throw new BadRequestException("ERROR: URI and entry user name do not match");
        }
       
        c = updateMembers((MemberEntrySet)c);
       
View Full Code Here

        try {
            UserManager mgr = getRoller().getUserManager();
           
            List permissionsDatas= new ArrayList();
            for (int i = 0; i < c.getEntries().length; i++) {
                MemberEntry entry = (MemberEntry)c.getEntries()[i];
                WeblogPermission pd = toPermissionsData(entry);
                mgr.savePermissions(pd);
                getRoller().flush();
                CacheManager.invalidate(pd.getUser());
                CacheManager.invalidate(pd.getWebsite());
View Full Code Here

    }
   
    private MemberEntrySet updateMembers(MemberEntrySet c) throws HandlerException {
        List permissionsDatas= new ArrayList();
        for (int i = 0; i < c.getEntries().length; i++) {
            MemberEntry entry = (MemberEntry)c.getEntries()[i];
            WeblogPermission pd = getPermissionsData(entry);
            if (pd == null) {
                throw new NotFoundException("ERROR: Permissions do not exist for weblog handle: " + entry.getHandle() + ", user name: " + entry.getName());
            }
            updatePermissionsData(pd, entry);
            permissionsDatas.add(pd);
        }
        return toMemberEntrySet((WeblogPermission[])permissionsDatas.toArray(new WeblogPermission[0]));
View Full Code Here

   
    private MemberEntry toMemberEntry(WeblogPermission pd) {
        if (pd == null) {
            throw new NullPointerException("ERROR: Null permission data not allowed");
        }
        MemberEntry me = new MemberEntry(pd.getWebsite().getHandle(), pd.getUser().getUserName(), getUrlPrefix());
        me.setPermission(maskToString(pd.getPermissionMask()));
       
        return me;
    }
View Full Code Here

       
        return wesResponse;
    }
   
    protected MemberEntrySet fetchSampleMember() throws IOException, JDOMException, UnexpectedRootElementException {
        MemberEntry me = getSampleMemberEntry();
       
        HttpResponse res = get(me.getHref(), getUser(), getPassword());
        assertEquals(200, res.getStatus());
       
        MemberEntrySet mesResponse = null;
        InputStream responseBody = res.getResponseBody();
        if (responseBody != null) {
View Full Code Here

       
        return wesResponse;
    }
   
    protected MemberEntrySet deleteSampleMember(boolean test) throws IOException, JDOMException, UnexpectedRootElementException {
        MemberEntry me = getSampleMemberEntry();
       
        HttpResponse res = delete(me.getHref(), getUser(), getPassword());
        if (test) {
            assertEquals(200, res.getStatus());
        } else if (res.getStatus() != 200) {
            return null;
        }
View Full Code Here

       
        return ue;
    }
   
    protected static MemberEntry getSampleMemberEntry() {
        MemberEntry me = new MemberEntry("fooblog", "foo", getEndpointUrl());
        me.setPermission(MemberEntry.Permissions.AUTHOR);
        return me;
    }
View Full Code Here

       
        return weUpdate;
    }
   
    protected static MemberEntry updateSampleMemberEntry(MemberEntry me) {
        MemberEntry meUpdate = new MemberEntry(me.getHandle(), me.getName(), getEndpointUrl());
        meUpdate.setPermission(MemberEntry.Permissions.LIMITED);
       
        return meUpdate;
    }
View Full Code Here

       
        return wesUpdated;
    }
   
    protected static MemberEntrySet updateSampleMemberEntrySet(MemberEntrySet mes) {
        MemberEntry me = (MemberEntry)mes.getEntries()[0];
        MemberEntry meUpdated = updateSampleMemberEntry(me);
        MemberEntrySet mesUpdated = new MemberEntrySet(getEndpointUrl());
        mesUpdated.setEntries(new MemberEntry[] { meUpdated });
       
        return mesUpdated;
    }
View Full Code Here

TOP

Related Classes of org.apache.roller.weblogger.webservices.adminprotocol.sdk.MemberEntry$Permissions

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.