View Javadoc
1   package com.randomnoun.common.security.impl;
2   
3   /* (c) 2013 randomnoun. All Rights Reserved. This work is licensed under a
4    * BSD Simplified License. (http://www.randomnoun.com/bsd-simplified.html)
5    */
6   
7   import java.io.IOException;
8   import java.util.*;
9   
10  import org.apache.log4j.Logger;
11  
12  import com.randomnoun.common.security.Permission;
13  import com.randomnoun.common.security.SecurityLoader;
14  import com.randomnoun.common.security.User;
15  import com.randomnoun.common.security.impl.NullSecurityLoaderImpl;
16  
17  /**
18   * An implementation of the {@link com.randomnoun.common.security.SecurityLoader}
19   * class, that does absolutely nothing.
20   * 
21   * <p>All methods do nothing or return empty lists, 
22   * and searches for user or role IDs return -1.
23   * 
24   * @author knoxg
25   */ 
26  public class NullSecurityLoaderImpl implements SecurityLoader
27  {
28      
29  	/** Logger for this class */
30  	public static final Logger logger = Logger.getLogger(NullSecurityLoaderImpl.class);
31  
32  	/** Initialise this loader.
33  	 *
34  	 * @see com.randomnoun.common.security.SecurityLoader#initialise(java.util.Map)
35  	 */
36  	public void initialise(Map<String, Object> properties) {
37  	}
38  
39  	public List<Permission> loadAllRolePermissions() throws IOException {
40  		return Collections.emptyList();
41  	}
42  
43  	public List<Permission> loadRolePermissions(String role) throws IOException {
44  		return Collections.emptyList();
45  	}
46  
47  	public List<Permission> loadUserRolePermissions(User user) throws IOException {
48  		return Collections.emptyList();	}
49  
50  	public List<Permission> loadUserPermissions(User user) throws IOException {
51  		return Collections.emptyList();	}
52  
53  	public List<String> loadUserRoles(User user) throws IOException {
54  		return Collections.emptyList();	
55  	}
56  
57  	public User loadUser(long userId) {
58  		return null;
59  	}
60  	
61  	public List<User> loadAllUsers() throws IOException  {
62  		return Collections.emptyList();	
63  	}
64  
65  	public List<String> loadAllResources() throws IOException {
66  		return null;
67  	}
68  
69  	public List<String> loadAllActivities(String resourceName) throws IOException {
70  		return Collections.emptyList();
71  	}
72  
73  	public List<String> loadAllRoles() throws IOException {
74  		return Collections.emptyList();
75  	}
76  
77  	public List<Permission> loadAllPermissions() throws IOException {
78  		return Collections.emptyList();
79  	}
80  
81  	public List<Map<String, Object>> loadAllRoleDetails() throws IOException {
82  		return Collections.emptyList();
83  	}
84  
85  	public List<Map<String, Object>> loadAllUserDetails() throws IOException {
86  		return Collections.emptyList();
87  	}
88  
89  	public void resetSecurityContext() throws IOException {
90  		
91  	}
92  
93  	public void saveUserRolesAndPermissions(User user, List<String> roles, List<Permission> userPermissions)
94  		throws IOException {
95  		throw new UnsupportedOperationException("not implemented");
96  	}
97  
98  	public void saveRolePermissions(String role, List<Permission> rolePermissions)
99  			throws IOException {
100 		throw new UnsupportedOperationException("not implemented");
101 	}
102 
103 	
104 }
105