Author: ate
Date: Mon Sep 1 06:38:37 2008
New Revision: 690968
URL: http://svn.apache.org/viewvc?rev=690968&view=rev
Log:
BaseJetspeedPrincipal implementation
Added:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalReadOnlyException.java
(with props)
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java?rev=690968&r1=690967&r2=690968&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java
(original)
+++
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java
Mon Sep 1 06:38:37 2008
@@ -19,9 +19,12 @@
import java.io.Serializable;
import java.sql.Timestamp;
+import java.util.Collection;
import org.apache.jetspeed.security.JetspeedPrincipal;
+import org.apache.jetspeed.security.JetspeedPrincipalManagerProvider;
import org.apache.jetspeed.security.JetspeedPrincipalType;
+import org.apache.jetspeed.security.PrincipalReadOnlyException;
import org.apache.jetspeed.security.SecurityAttributes;
/**
@@ -31,75 +34,98 @@
public class BaseJetspeedPrincipal implements JetspeedPrincipal, Serializable
{
private static final long serialVersionUID = 5484179899807809619L;
-
- public Timestamp getCreationDate()
+
+ private static JetspeedPrincipalManagerProvider jpmp;
+
+ private Long id;
+ private String name;
+ private Timestamp creationDate;
+ private Timestamp modifiedDate;
+ private boolean enabled;
+ private boolean mapped;
+ private boolean readOnly;
+ private boolean removable;
+ private boolean extendable;
+ @SuppressWarnings("unchecked")
+ private Collection avColl;
+
+ private transient JetspeedPrincipalType jpt;
+ private transient SecurityAttributes attributes;
+
+ public static void
setJetspeedPrincipalManagerProvider(JetspeedPrincipalManagerProvider jpmp)
{
- // TODO Auto-generated method stub
- return null;
+ BaseJetspeedPrincipal.jpmp = jpmp;
}
-
+
public Long getId()
{
- // TODO Auto-generated method stub
- return null;
+ return id;
}
- public Timestamp getModifiedDate()
+ public String getName()
{
- // TODO Auto-generated method stub
- return null;
+ return name;
}
- public String getName()
+ public synchronized JetspeedPrincipalType getType()
{
- // TODO Auto-generated method stub
- return null;
+ if (jpt == null)
+ {
+ jpt = jpmp.getPrincipalTypeByClassName(getClass().getName());
+ }
+ return jpt;
}
- public SecurityAttributes getSecurityAttributes()
+ public Timestamp getCreationDate()
{
- // TODO Auto-generated method stub
- return null;
+ return creationDate;
}
- public JetspeedPrincipalType getType()
+ public Timestamp getModifiedDate()
{
- // TODO Auto-generated method stub
- return null;
+ return modifiedDate;
}
public boolean isEnabled()
{
- // TODO Auto-generated method stub
- return false;
+ return enabled;
}
- public boolean isExtendable()
+ public void setEnabled(boolean enabled) throws PrincipalReadOnlyException
{
- // TODO Auto-generated method stub
- return false;
+ if (isReadOnly())
+ {
+ throw new PrincipalReadOnlyException();
+ }
+ this.enabled = enabled;
}
-
+
public boolean isMapped()
{
- // TODO Auto-generated method stub
- return false;
+ return mapped;
}
public boolean isReadOnly()
{
- // TODO Auto-generated method stub
- return false;
+ return readOnly;
}
public boolean isRemovable()
{
- // TODO Auto-generated method stub
- return false;
+ return removable;
}
- public void setEnable(boolean enabled)
+ public boolean isExtendable()
+ {
+ return extendable;
+ }
+
+ public synchronized SecurityAttributes getSecurityAttributes()
{
- // TODO Auto-generated method stub
+ if (attributes == null)
+ {
+ attributes = new SecurityAttributesImpl(this, avColl,
isReadOnly(), isExtendable());
+ }
+ return attributes;
}
}
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java?rev=690968&r1=690967&r2=690968&view=diff
==============================================================================
---
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
(original)
+++
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/JetspeedPrincipal.java
Mon Sep 1 06:38:37 2008
@@ -35,7 +35,7 @@
boolean isEnabled();
- void setEnable(boolean enabled);
+ void setEnabled(boolean enabled) throws PrincipalReadOnlyException;
boolean isMapped(); // true if managed (mapped) through an external
authorization provider (e.g. LDAP)
Added:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalReadOnlyException.java
URL:
http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalReadOnlyException.java?rev=690968&view=auto
==============================================================================
---
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalReadOnlyException.java
(added)
+++
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalReadOnlyException.java
Mon Sep 1 06:38:37 2008
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.security;
+
+import org.apache.jetspeed.exception.JetspeedException;
+
+/**
+ * @version $Id$
+ */
+public class PrincipalReadOnlyException extends JetspeedException
+{
+ private static final long serialVersionUID = 4466707431862853405L;
+}
Propchange:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalReadOnlyException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalReadOnlyException.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange:
portals/jetspeed-2/portal/branches/security-refactoring/jetspeed-api/src/main/java/org/apache/jetspeed/security/PrincipalReadOnlyException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]