You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2008/11/19 23:30:08 UTC
svn commit: r719099 - in
/lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya:
ac/impl/ cms/workflow/ transaction/
Author: andreas
Date: Wed Nov 19 14:30:08 2008
New Revision: 719099
URL: http://svn.apache.org/viewvc?rev=719099&view=rev
Log:
Committing changes to impl.
Modified:
lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/ac/impl/AbstractAccessControlTest.java
lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/cms/workflow/WorkflowTest.java
lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/MockTransactionable.java
lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/MockUser.java
lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/TransactionTest.java
Modified: lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/ac/impl/AbstractAccessControlTest.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/ac/impl/AbstractAccessControlTest.java?rev=719099&r1=719098&r2=719099&view=diff
==============================================================================
--- lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/ac/impl/AbstractAccessControlTest.java (original)
+++ lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/ac/impl/AbstractAccessControlTest.java Wed Nov 19 14:30:08 2008
@@ -28,8 +28,10 @@
import org.apache.lenya.ac.Accreditable;
import org.apache.lenya.ac.AccreditableManager;
import org.apache.lenya.ac.Identity;
+import org.apache.lenya.ac.ManagedUserReference;
import org.apache.lenya.ac.PolicyManager;
import org.apache.lenya.ac.User;
+import org.apache.lenya.ac.UserReference;
import org.apache.lenya.ac.file.FileAccreditableManager;
import org.apache.lenya.cms.LenyaTestCase;
import org.apache.lenya.cms.ac.PublicationAccessControllerResolver;
@@ -74,21 +76,23 @@
org.apache.cocoon.environment.Session cocoonSession = getRequest().getSession();
Identity identity = (Identity) cocoonSession.getAttribute(Identity.class.getName());
+
+ UserReference ref = new ManagedUserReference(user.getId(), acMgr.getId());
- if (!identity.contains(user)) {
- User oldUser = identity.getUser();
+ if (!identity.contains(ref)) {
+ UserReference oldUser = identity.getUserReference();
if (oldUser != null) {
if (getLogger().isDebugEnabled()) {
getLogger().debug("Removing user [" + oldUser + "] from identity.");
}
identity.removeIdentifiable(oldUser);
}
- identity.addIdentifiable(user);
+ identity.addIdentifiable(ref);
}
ac.authorize(getRequest());
- Accreditable[] accrs = identity.getAccreditables();
+ Accreditable[] accrs = identity.getAccreditables(acMgr);
for (int i = 0; i < accrs.length; i++) {
getLogger().info("Accreditable: " + accrs[i]);
}
Modified: lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/cms/workflow/WorkflowTest.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/cms/workflow/WorkflowTest.java?rev=719099&r1=719098&r2=719099&view=diff
==============================================================================
--- lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/cms/workflow/WorkflowTest.java (original)
+++ lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/cms/workflow/WorkflowTest.java Wed Nov 19 14:30:08 2008
@@ -106,7 +106,7 @@
protected Session getSession(TestSituation situation) throws AccessControlException,
RepositoryException {
Session session = login(situation.getUser());
- getLogger().info("User: [" + session.getIdentity().getUser() + "]");
+ getLogger().info("User: [" + session.getIdentity().getUserReference().getId() + "]");
return session;
}
Modified: lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/MockTransactionable.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/MockTransactionable.java?rev=719099&r1=719098&r2=719099&view=diff
==============================================================================
--- lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/MockTransactionable.java (original)
+++ lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/MockTransactionable.java Wed Nov 19 14:30:08 2008
@@ -80,7 +80,7 @@
}
private String getUserId() {
- return ((UnitOfWorkImpl) this.unit).getIdentity().getUser().getId();
+ return ((UnitOfWorkImpl) this.unit).getIdentity().getUserReference().getId();
}
private Lock lock;
Modified: lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/MockUser.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/MockUser.java?rev=719099&r1=719098&r2=719099&view=diff
==============================================================================
--- lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/MockUser.java (original)
+++ lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/MockUser.java Wed Nov 19 14:30:08 2008
@@ -31,6 +31,8 @@
public class MockUser implements User {
+ public static final String ACCR_MGR_ID = "mock";
+
private String id;
public MockUser(String id) {
@@ -87,7 +89,7 @@
}
- public Accreditable[] getAccreditables() {
+ public Accreditable[] getAccreditablesToAuthorize() {
// TODO Auto-generated method stub
return null;
}
@@ -166,4 +168,12 @@
return false;
}
+ public String[] getAttributeNames() {
+ return new String[0];
+ }
+
+ public String[] getAttributeValues(String name) throws AccessControlException {
+ return new String[0];
+ }
+
}
Modified: lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/TransactionTest.java
URL: http://svn.apache.org/viewvc/lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/TransactionTest.java?rev=719099&r1=719098&r2=719099&view=diff
==============================================================================
--- lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/TransactionTest.java (original)
+++ lenya/sandbox/access_control_redesign/src/impl/test/org/apache/lenya/transaction/TransactionTest.java Wed Nov 19 14:30:08 2008
@@ -19,16 +19,18 @@
import org.apache.cocoon.core.container.ContainerTestCase;
import org.apache.lenya.ac.Identity;
+import org.apache.lenya.ac.IdentityImpl;
+import org.apache.lenya.ac.ManagedUserReference;
public class TransactionTest extends ContainerTestCase {
public void testTransaction() throws TransactionException {
- Identity lenya = new Identity(getLogger());
- lenya.addIdentifiable(new MockUser("lenya"));
+ Identity lenya = new IdentityImpl(MockUser.ACCR_MGR_ID, getLogger());
+ lenya.addIdentifiable(new ManagedUserReference("lenya", MockUser.ACCR_MGR_ID));
- Identity alice = new Identity(getLogger());
- alice.addIdentifiable(new MockUser("alice"));
+ Identity alice = new IdentityImpl(MockUser.ACCR_MGR_ID, getLogger());
+ alice.addIdentifiable(new ManagedUserReference("alice", MockUser.ACCR_MGR_ID));
IdentityMap lenyaMap = new IdentityMapImpl(getLogger());
UnitOfWork lenyaUnit = new UnitOfWorkImpl(lenyaMap, lenya, getLogger());
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org