01: package com.pentaho.security.ldap.search;
02:
03: import java.util.Collections;
04: import java.util.List;
05:
06: /**
07: * Returns the list configured via the <code>staticList</code> property. (Makes no connection to a directory.)
08: * One way to use this class would be to use it along with <code>UnionizingLdapSearch</code> to return a list of
09: * additional roles or usernames. This is useful when you want to use the Admin Permissions interface to assign
10: * ACLs but the role or username that you wish to use is not actually present in the directory (e.g.
11: * <code>Anonymous</code>).
12: *
13: * @author mlowery
14: */
15: public class StaticListLdapSearch implements LdapSearch {
16:
17: private List staticList = Collections.EMPTY_LIST;
18:
19: public List search(final Object[] ignored) {
20: return staticList;
21: }
22:
23: public void setStaticList(final List staticList) {
24: if (null == staticList) {
25: this .staticList = Collections.EMPTY_LIST;
26: } else {
27: this .staticList = staticList;
28: }
29: }
30:
31: public List getStaticList() {
32: return staticList;
33: }
34:
35: }
|