01: /*
02: * Copyright 2007 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho
07: * BI Platform. The Initial Developer is Pentaho Corporation.
08: *
09: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
10: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
11: * the license for the specific language governing your rights and limitations.
12: */
13: package com.pentaho.security.acls.voter;
14:
15: import java.util.List;
16:
17: import org.acegisecurity.Authentication;
18: import org.acegisecurity.GrantedAuthority;
19: import org.acegisecurity.acl.AclEntry;
20: import org.pentaho.core.session.IPentahoSession;
21:
22: import com.pentaho.security.SecurityUtils;
23: import com.pentaho.security.acls.IAclHolder;
24: import com.pentaho.security.acls.PentahoAclEntry;
25:
26: public class PentahoAllowAllAclVoter extends AbstractPentahoAclVoter {
27:
28: public boolean hasAccess(IPentahoSession session,
29: IAclHolder holder, int mask) {
30: // Return true indicating that there are no access prohibitions.
31: return true;
32: }
33:
34: public Authentication getAuthentication(IPentahoSession session) {
35: return SecurityUtils.getAuthentication(session, true);
36: }
37:
38: public AclEntry[] getEffectiveAcls(IPentahoSession session,
39: IAclHolder holder) {
40: // Returns all the ACLs on the object which indicates that the
41: // user has all the necessary acls to access the object.
42: List allAcls = holder.getEffectiveAccessControls();
43: AclEntry[] acls = new AclEntry[allAcls.size()];
44: acls = (AclEntry[]) allAcls.toArray(acls);
45: return acls;
46: }
47:
48: public PentahoAclEntry getEffectiveAcl(IPentahoSession session,
49: IAclHolder holder) {
50: PentahoAclEntry rtn = new PentahoAclEntry();
51: rtn.setMask(PentahoAclEntry.ADMIN_ALL);
52: return rtn;
53: }
54:
55: public boolean isPentahoAdministrator(IPentahoSession session) {
56: // This system is wide open. All users are managers.
57: return true;
58: }
59:
60: public boolean isGranted(IPentahoSession session,
61: GrantedAuthority auth) {
62: // This system is wide open. Everyone is granted everything.
63: return true;
64: }
65:
66: }
|