001package com.randomnoun.common.security.impl;
002
003/* (c) 2013 randomnoun. All Rights Reserved. This work is licensed under a
004 * BSD Simplified License. (http://www.randomnoun.com/bsd-simplified.html)
005 */
006
007import java.io.IOException;
008import java.util.*;
009
010import org.apache.log4j.Logger;
011
012import com.randomnoun.common.security.Permission;
013import com.randomnoun.common.security.SecurityLoader;
014import com.randomnoun.common.security.User;
015import com.randomnoun.common.security.impl.NullSecurityLoaderImpl;
016
017/**
018 * An implementation of the {@link com.randomnoun.common.security.SecurityLoader}
019 * class, that does absolutely nothing.
020 * 
021 * <p>All methods do nothing or return empty lists, 
022 * and searches for user or role IDs return -1.
023 * 
024 * @author knoxg
025 */ 
026public class NullSecurityLoaderImpl implements SecurityLoader
027{
028    
029        /** Logger for this class */
030        public static final Logger logger = Logger.getLogger(NullSecurityLoaderImpl.class);
031
032        /** Initialise this loader.
033         *
034         * @see com.randomnoun.common.security.SecurityLoader#initialise(java.util.Map)
035         */
036        public void initialise(Map<String, Object> properties) {
037        }
038
039        public List<Permission> loadAllRolePermissions() throws IOException {
040                return Collections.emptyList();
041        }
042
043        public List<Permission> loadRolePermissions(String role) throws IOException {
044                return Collections.emptyList();
045        }
046
047        public List<Permission> loadUserRolePermissions(User user) throws IOException {
048                return Collections.emptyList(); }
049
050        public List<Permission> loadUserPermissions(User user) throws IOException {
051                return Collections.emptyList(); }
052
053        public List<String> loadUserRoles(User user) throws IOException {
054                return Collections.emptyList(); 
055        }
056
057        public User loadUser(long userId) {
058                return null;
059        }
060        
061        public List<User> loadAllUsers() throws IOException  {
062                return Collections.emptyList(); 
063        }
064
065        public List<String> loadAllResources() throws IOException {
066                return null;
067        }
068
069        public List<String> loadAllActivities(String resourceName) throws IOException {
070                return Collections.emptyList();
071        }
072
073        public List<String> loadAllRoles() throws IOException {
074                return Collections.emptyList();
075        }
076
077        public List<Permission> loadAllPermissions() throws IOException {
078                return Collections.emptyList();
079        }
080
081        public List<Map<String, Object>> loadAllRoleDetails() throws IOException {
082                return Collections.emptyList();
083        }
084
085        public List<Map<String, Object>> loadAllUserDetails() throws IOException {
086                return Collections.emptyList();
087        }
088
089        public void resetSecurityContext() throws IOException {
090                
091        }
092
093        public void saveUserRolesAndPermissions(User user, List<String> roles, List<Permission> userPermissions)
094                throws IOException {
095                throw new UnsupportedOperationException("not implemented");
096        }
097
098        public void saveRolePermissions(String role, List<Permission> rolePermissions)
099                        throws IOException {
100                throw new UnsupportedOperationException("not implemented");
101        }
102
103        
104}
105