lenya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andr...@apache.org
Subject svn commit: r178146 - in /lenya/trunk/src/java/org/apache/lenya/cms/ac: cocoon/ usecases/AccessControl.java usecases/CredentialWrapper.java
Date Tue, 24 May 2005 09:47:23 GMT
Author: andreas
Date: Tue May 24 02:47:20 2005
New Revision: 178146

URL: http://svn.apache.org/viewcvs?rev=178146&view=rev
Log:
removed obsolete PolicyHelper

Added:
    lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/CredentialWrapper.java
Removed:
    lenya/trunk/src/java/org/apache/lenya/cms/ac/cocoon/
Modified:
    lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/AccessControl.java

Modified: lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/AccessControl.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/AccessControl.java?rev=178146&r1=178145&r2=178146&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/AccessControl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/AccessControl.java Tue May 24 02:47:20
2005
@@ -22,7 +22,6 @@
 import java.util.List;
 
 import org.apache.cocoon.ProcessingException;
-import org.apache.lenya.cms.ac.cocoon.CredentialWrapper;
 import org.apache.lenya.cms.publication.Document;
 import org.apache.lenya.cms.publication.DocumentIdentityMap;
 import org.apache.lenya.cms.publication.URLInformation;

Added: lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/CredentialWrapper.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/CredentialWrapper.java?rev=178146&view=auto
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/CredentialWrapper.java (added)
+++ lenya/trunk/src/java/org/apache/lenya/cms/ac/usecases/CredentialWrapper.java Tue May 24
02:47:20 2005
@@ -0,0 +1,114 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation
+ *
+ *  Licensed 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.lenya.cms.ac.usecases;
+
+import org.apache.lenya.ac.Accreditable;
+import org.apache.lenya.ac.Group;
+import org.apache.lenya.ac.IPRange;
+import org.apache.lenya.ac.Item;
+import org.apache.lenya.ac.Role;
+import org.apache.lenya.ac.User;
+
+/**
+ * Wrapper class for credentials.
+ * @version $Id: CredentialWrapper.java 152682 2005-02-08 18:13:39Z gregor $
+ */
+public class CredentialWrapper {
+
+    /**
+     * Returns the accreditable ID.
+     * @return A string.
+     */
+    public String getAccreditableId() {
+        return this.accreditableId;
+    }
+
+    /**
+     * Returns the accreditable name.
+     * @return A string.
+     */
+    public String getAccreditableName() {
+        return this.accreditableName;
+    }
+
+    /**
+     * Returns the role ID.
+     * @return A string.
+     */
+    public String getRoleId() {
+        return this.roleId;
+    }
+
+    /**
+     * Returns the role name.
+     * @return A string.
+     */
+    public String getRoleName() {
+        return this.roleName;
+    }
+
+    /**
+     * Returns the accreditable type ({@link #USER}, {@link #GROUP}, or {@link #IPRANGE})
+     * @return A string.
+     */
+    public String getType() {
+        return this.type;
+    }
+
+    /**
+     * Ctor.
+     * @param accreditable The accreditable of the credential to wrap.
+     * @param role The role of the credential to wrap.
+     */
+    public CredentialWrapper(Accreditable accreditable, Role role) {
+        if (accreditable instanceof Item) {
+            Item item = (Item) accreditable;
+            this.accreditableId = item.getId();
+            this.accreditableName = item.getName();
+        
+            if (item instanceof User) {
+                this.type = USER;
+            }
+            else if (item instanceof Group) {
+                this.type = GROUP;
+            }
+            else if (item instanceof IPRange) {
+                this.type = IPRANGE;
+            }
+        }
+        else {
+            this.accreditableId = "world";
+            this.accreditableName = "the world";
+            this.type = "world";
+        }
+        this.roleId = role.getId();
+        this.roleName = role.getName();
+        
+    }
+    
+    protected static final String USER = "user";
+    protected static final String GROUP = "group";
+    protected static final String IPRANGE = "iprange";
+    
+    private String type;
+    private String accreditableId;
+    private String accreditableName;
+    private String roleId;
+    private String roleName;
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org


Mime
View raw message