Examples of Authority


Examples of org.apache.rave.model.Authority

        assertNotNull(authority);
    }

    @Test
    public void convert_Valid(){
        Authority authority = new AuthorityImpl();
        authority.setAuthority("asd;lkfjlkj");
        authority.setDefaultForNewUser(true);

        MongoDbAuthority converted = authorityConverter.convert(authority);
        assertNotNull(converted.getAuthority());
        //assertNotNull(converted.getId());
        assertThat(converted.getAuthority(), is(sameInstance(authority.getAuthority())));
        assertThat(converted.isDefaultForNewUser(), is(sameInstance(authority.isDefaultForNewUser())));

        Authority authorityMongo = new MongoDbAuthority();
        authorityMongo.setAuthority("authority");
        authorityMongo.setDefaultForNewUser(true);
        MongoDbAuthority mongoConverted = authorityConverter.convert(authorityMongo);
        assertThat(mongoConverted, is(sameInstance(authorityMongo)));
        assertThat(mongoConverted.getAuthority(), is(sameInstance(authorityMongo.getAuthority())));
        assertThat(mongoConverted.isDefaultForNewUser(), is(sameInstance(authorityMongo.isDefaultForNewUser())));
    }
View Full Code Here

Examples of org.apache.rave.portal.model.Authority

        return new SearchResult<User>(users, totalResult);
    }

    private static SearchResult<Authority> createSearchResultWithTwoAuthorities() {
        List<Authority> authorities = new ArrayList<Authority>();
        Authority foo = new Authority();
        foo.setAuthority("FOO");
        Authority bar = new Authority();
        bar.setAuthority("BAR");
        authorities.add(foo);
        authorities.add(bar);
        return new SearchResult<Authority>(authorities, authorities.size());
    }
View Full Code Here

Examples of org.apache.rave.portal.model.Authority

     */
    private class AuthorityEditor extends PropertyEditorSupport {

        @Override
        public void setAsText(String text) throws IllegalArgumentException {
            Authority authority = authorityService.getAuthorityByName(text);
            setValue(authority);
        }
View Full Code Here

Examples of org.apache.rave.portal.model.Authority

        validPageLayout = new PageLayout();
        validPageLayout.setEntityId(99L);
        validPageLayout.setNumberOfRegions(4L);
        validPageLayout.setCode(VALID_LAYOUT_CODE);
       
        Authority role1 = new Authority();
        role1.setAuthority("DEFAULT_ROLE1");
        Authority role2 = new Authority();
        role2.setAuthority("DEFAULT_ROLE2");
       
        validAuthorityList = new ArrayList<Authority>();
        validAuthorityList.add(role1);
        validAuthorityList.add(role2);
        validAuthoritySearchResult = new SearchResult<Authority>(validAuthorityList, validAuthorityList.size());       
View Full Code Here

Examples of org.apache.rave.portal.model.Authority

     */
    private class AuthorityEditor extends PropertyEditorSupport {

        @Override
        public void setAsText(String text) throws IllegalArgumentException {
            Authority authority = authorityService.getAuthorityByName(text);
            setValue(authority);
        }
View Full Code Here

Examples of org.apache.rave.portal.model.Authority

        assertThat(user.getEmail(), is(equalTo(USER_EMAIL)));
    }

    @Test
    public void addOrDeleteUserDoesNotAffectAuthority() {
        Authority authority = authorityRepository.get(1L);
        Assert.assertNotNull("Existing authority", authority);

        int usercount = authority.getUsers().size();
        User user = new User();
        user.setUsername("dummy");
        authority.addUser(user);
        authorityRepository.save(authority);
        assertNull("Persisting an Authority does not persist an unknown user", repository.getByUsername("dummy"));
        Assert.assertEquals("Authority has 1 more user", usercount + 1, authority.getUsers().size());

        repository.save(user);
        user = repository.getByUsername("dummy");
        Assert.assertNotNull(user);
        Assert.assertEquals("Authority has 1 more user", usercount + 1, authority.getUsers().size());

        repository.delete(user);
        authority = authorityRepository.get(1L);
        Assert.assertNotNull("Authority has not been removed after deleting user", authority);
        Assert.assertEquals("Authority has original amount of users", usercount, authority.getUsers().size());
    }
View Full Code Here

Examples of org.apache.rave.portal.model.Authority

        return new SearchResult<User>(users, totalResult);
    }

    private static SearchResult<Authority> createSearchResultWithTwoAuthorities() {
        List<Authority> authorities = new ArrayList<Authority>();
        Authority foo = new AuthorityImpl();
        foo.setAuthority("FOO");
        Authority bar = new AuthorityImpl();
        bar.setAuthority("BAR");
        authorities.add(foo);
        authorities.add(bar);
        return new SearchResult<Authority>(authorities, authorities.size());
    }
View Full Code Here

Examples of org.apache.shindig.common.servlet.Authority

    return config;
   
  }
 
  private Authority createAuthorityMock() {
    Authority mockAuthority = createMock(Authority.class);
    expect(mockAuthority.getAuthority()).andReturn("http://example.com").anyTimes();
    expect(mockAuthority.getOrigin()).andReturn("mockOrigin").anyTimes();
    replay(mockAuthority);
    return mockAuthority;
  }
View Full Code Here

Examples of org.beangle.ems.security.Authority

    List<Group> groups = userService.getGroups(user, GroupMember.Ship.MEMBER);
    for (final Group group : groups) {
      List<Authority> groupAuths = getAuthorities(group);
      for (final Authority groupAuth : groupAuths) {
        if (authorities.containsKey(groupAuth.getResource())) {
          Authority existed = authorities.get(groupAuth.getResource());
          existed.merge(groupAuth);
        } else {
          authorities.put(groupAuth.getResource(), groupAuth);
        }
      }
    }
View Full Code Here

Examples of org.beangle.ems.security.Authority

    return CollectUtils.newArrayList(authorities.values());
  }

  public Authority getAuthority(User user, Resource resource) {
    if ((null == user) || null == resource) return null;
    Authority au = null;
    List<Group> groups = userService.getGroups(user, GroupMember.Ship.MEMBER);
    for (final Group one : groups) {
      Authority ar = getAuthority(one, resource);
      if (null == au) {
        au = ar;
      } else {
        au.merge(ar);
      }
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.