KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > security > permissions > impl > model > GlobalPermissionEntry


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.repo.security.permissions.impl.model;
18
19 import org.alfresco.repo.security.permissions.PermissionEntry;
20 import org.alfresco.repo.security.permissions.PermissionReference;
21 import org.alfresco.service.cmr.repository.NodeRef;
22 import org.alfresco.service.cmr.security.AccessStatus;
23 import org.alfresco.service.namespace.NamespacePrefixResolver;
24 import org.dom4j.Attribute;
25 import org.dom4j.Element;
26
27 public class GlobalPermissionEntry implements XMLModelInitialisable, PermissionEntry
28 {
29     private static final String JavaDoc AUTHORITY = "authority";
30     
31     private static final String JavaDoc PERMISSION = "permission";
32     
33     private String JavaDoc authority;
34     
35     private PermissionReference permissionReference;
36     
37     public GlobalPermissionEntry()
38     {
39         super();
40         // TODO Auto-generated constructor stub
41
}
42
43     public void initialise(Element element, NamespacePrefixResolver nspr, PermissionModel permissionModel)
44     {
45         Attribute authorityAttribute = element.attribute(AUTHORITY);
46         if(authorityAttribute != null)
47         {
48             authority = authorityAttribute.getStringValue();
49         }
50         Attribute permissionAttribute = element.attribute(PERMISSION);
51         if(permissionAttribute != null)
52         {
53             permissionReference = permissionModel.getPermissionReference(null, permissionAttribute.getStringValue());
54         }
55
56     }
57     
58     public String JavaDoc getAuthority()
59     {
60         return authority;
61     }
62     
63     public PermissionReference getPermissionReference()
64     {
65         return permissionReference;
66     }
67
68     public NodeRef getNodeRef()
69     {
70         return null;
71     }
72
73     public boolean isDenied()
74     {
75         return false;
76     }
77
78     public boolean isAllowed()
79     {
80         return true;
81     }
82
83     public AccessStatus getAccessStatus()
84     {
85         return AccessStatus.ALLOWED;
86     }
87
88 }
89
Popular Tags