Package com.opengamma.security.user

Examples of com.opengamma.security.user.Authority


  public void basicPermissionCheck() {
    Set<UserGroup> userGroups = new HashSet<UserGroup>();

    UserGroup group1 = new UserGroup(0L, "group1");
    group1.getAuthorities().add(new Authority(0L, "LiveData/Bloomberg/Equity/**")); // ** -> all subpaths OK
    group1.getAuthorities().add(new Authority(1L, "LiveData/Bloomberg/Bond/*")); // * -> only 1 level of subpath OK
    userGroups.add(group1);
   
    UserGroup group2 = new UserGroup(1L, "group2");
    group2.getAuthorities().add(new Authority(2L, "LiveData/Reuters/Equity/**"));
    userGroups.add(group2);
   
    User user = new User(null,
        "john",
        "pw",
View Full Code Here


    user = getTestUser();
    Set<UserGroup> userGroups = new HashSet<UserGroup>();
    UserGroup userGroup = _userManager.getUserGroup("testusergroup");
    if (userGroup == null) {
      userGroup = new UserGroup(null, "testusergroup");
      userGroup.getAuthorities().add(new Authority("testauthority"));
    }
    userGroup.getUsers().add(user);
    user.setUserGroups(userGroups);
    _userManager.addUser(user);
   
View Full Code Here

    }
   
    // Add
    userGroup = new UserGroup(null, "testusergroup");
   
    Authority authority = _userManager.getAuthority("testauthority");
    if (authority == null) {
      authority = new Authority("testauthority");
      _userManager.addAuthority(authority);
    }
    userGroup.getAuthorities().add(authority);
   
    User user = _userManager.getUser("testuser");
    if (user == null) {
      user = getTestUser();
      _userManager.addUser(user);
    }
   
    _userManager.addUserGroup(userGroup);
   
    // Update
    Authority additionalAuthority = _userManager.getAuthority("additionalauthority");
    if (additionalAuthority == null) {
      additionalAuthority = new Authority("additionalauthority");
      _userManager.addAuthority(additionalAuthority);
    }
    userGroup.getAuthorities().add(additionalAuthority);
    _userManager.updateUserGroup(userGroup);
    userGroup = _userManager.getUserGroup("testusergroup");
View Full Code Here

  }

  @Test
  public void testAuthorityManagement() {
    // Try to get non-existent
    Authority authority = _userManager.getAuthority("nonexistentauthority");
    assertNull(authority);
   
    // Clear DB as necessary
    authority = _userManager.getAuthority("authority");
    if (authority != null) {
      _userManager.deleteAuthority(authority);
    }
   
    // Add
    authority = new Authority("regex");
    _userManager.addAuthority(authority);
   
    // Update
    authority.setRegex("newregex");
    _userManager.updateAuthority(authority);
    authority = _userManager.getAuthority("regex");
    assertNull(authority);
    authority = _userManager.getAuthority("newregex");
    assertNotNull(authority);
    assertEquals("newregex", authority.getRegex());
   
    // Delete
    _userManager.deleteAuthority(authority);
    authority = _userManager.getAuthority("newregex");
    assertNull(authority);
View Full Code Here

TOP

Related Classes of com.opengamma.security.user.Authority

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.