Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2007 - 2008 Pentaho Corporation.  All rights reserved.
   * This software was developed by Pentaho Corporation and is provided under the terms 
   * of the Mozilla Public License, Version 1.1, or any later version. You may not use 
   * this file except in compliance with the license. If you need a copy of the license, 
   * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho 
   * BI Platform.  The Initial Developer is Pentaho Corporation.
   *
   * Software distributed under the Mozilla Public License is distributed on an "AS IS" 
  * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
  * the license for the specific language governing your rights and limitations.
  */
 package org.pentaho.platform.plugin.services.security.userrole.ldap;
 
 import java.util.List;
 
 
 
   // ~ Static fields/initializers ======================================================================================
 
   // private static final Log logger = LogFactory.getLog(DefaultLdapUserRoleListService.class);
 
   // ~ Instance fields =================================================================================================
 
   // private InitialDirContextFactory initialDirContextFactory;
 
 
 
   private LdapSearch usernamesInRoleSearch;

  
Case-sensitive by default.
 
Case-sensitive by default.
 
   private Comparator<StringusernameComparator;

  
Used only for getAuthoritiesForUser. This is preferred over an LdapSearch in authoritiesForUserSearch as it keeps roles returned by UserDetailsService and roles returned by DefaultLdapUserRoleListService consistent.
 
 
   // ~ Constructors ====================================================================================================
 
   public DefaultLdapUserRoleListService(final InitialDirContextFactory initialDirContextFactory) {
     // this.initialDirContextFactory = initialDirContextFactory;
   }
 
   public DefaultLdapUserRoleListService(final InitialDirContextFactory initialDirContextFactory,
       final Comparator<StringusernameComparatorfinal Comparator<GrantedAuthoritygrantedAuthorityComparator) {
     // this.initialDirContextFactory = initialDirContextFactory;
     this. = usernameComparator;
     this. = grantedAuthorityComparator;
   }
 
   // ~ Methods =========================================================================================================
 
   public void afterPropertiesSet() throws Exception {
   }
 
     List<GrantedAuthorityresults = .search(new Object[0]);
     if (null != ) {
       Collections.sort(results);
     }
     return results.toArray(new GrantedAuthority[0]);
   }
 
   public String[] getAllUsernames() {
     List<Stringresults = .search(new Object[0]);
     if (null != ) {
       Collections.sort(results);
     }
     return results.toArray(new String[0]);
   }
 
   public String[] getUsernamesInRole(final GrantedAuthority authority) {
     List<Stringresults = .search(new Object[] { authority });
     if (null != ) {
      Collections.sort(results);
    }
    return results.toArray(new String[0]);
  }
  public GrantedAuthority[] getAuthoritiesForUser(final String username) {
    List<GrantedAuthorityresults = Arrays.asList(user.getAuthorities());
    if (null != ) {
      Collections.sort(results);
    }
    return results.toArray(new GrantedAuthority[0]);
  }
  public void setAllUsernamesSearch(final LdapSearch allUsernamesSearch) {
    this. = allUsernamesSearch;
  }
  public void setAllAuthoritiesSearch(final LdapSearch allAuthoritiesSearch) {
    this. = allAuthoritiesSearch;
  }
  public void setUsernamesInRoleSearch(final LdapSearch usernamesInRoleSearch) {
    this. = usernamesInRoleSearch;
  }
  public void setUserDetailsService(final LdapUserDetailsService userDetailsService) {
    this. = userDetailsService;
  }
  public void setGrantedAuthorityComparator(final Comparator<GrantedAuthoritygrantedAuthorityComparator) {
    Assert.notNull(grantedAuthorityComparator);
    this. = grantedAuthorityComparator;
  }
  public void setUsernameComparator(final Comparator<StringusernameComparator) {
    Assert.notNull(usernameComparator);
    this. = usernameComparator;
  }
New to GrepCode? Check out our FAQ X