%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.jetspeed.layout.impl.RolesSecurityBehavior |
|
|
1 | /* |
|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more |
|
3 | * contributor license agreements. See the NOTICE file distributed with |
|
4 | * this work for additional information regarding copyright ownership. |
|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0 |
|
6 | * (the "License"); you may not use this file except in compliance with |
|
7 | * the License. You may obtain a copy of the License at |
|
8 | * |
|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 | * |
|
11 | * Unless required by applicable law or agreed to in writing, software |
|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 | * See the License for the specific language governing permissions and |
|
15 | * limitations under the License. |
|
16 | */ |
|
17 | package org.apache.jetspeed.layout.impl; |
|
18 | ||
19 | import java.util.Iterator; |
|
20 | import java.util.List; |
|
21 | ||
22 | import org.apache.commons.logging.Log; |
|
23 | import org.apache.commons.logging.LogFactory; |
|
24 | import org.apache.jetspeed.layout.PortletActionSecurityBehavior; |
|
25 | import org.apache.jetspeed.request.RequestContext; |
|
26 | ||
27 | /** |
|
28 | * Abstracted behavior of security checks for portlet actions |
|
29 | * |
|
30 | * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a> |
|
31 | * @version $Id: $ |
|
32 | */ |
|
33 | public class RolesSecurityBehavior implements PortletActionSecurityBehavior |
|
34 | { |
|
35 | 0 | protected Log log = LogFactory.getLog(PortletActionSecurityPathBehavior.class); |
36 | protected List roles; |
|
37 | ||
38 | public RolesSecurityBehavior(List roles) |
|
39 | 0 | { |
40 | 0 | this.roles = roles; |
41 | 0 | } |
42 | ||
43 | public boolean checkAccess(RequestContext context, String action) |
|
44 | { |
|
45 | 0 | Iterator iterator = roles.iterator(); |
46 | 0 | while (iterator.hasNext()) |
47 | { |
|
48 | 0 | String role = (String)iterator.next(); |
49 | 0 | if (context.getRequest().isUserInRole(role)) |
50 | 0 | return true; |
51 | 0 | } |
52 | 0 | return false; |
53 | } |
|
54 | ||
55 | public boolean isCreateNewPageOnEditEnabled() |
|
56 | { |
|
57 | 0 | return false; |
58 | } |
|
59 | public boolean isPageQualifiedForCreateNewPageOnEdit(RequestContext context) |
|
60 | { |
|
61 | 0 | return false ; |
62 | } |
|
63 | ||
64 | public boolean createNewPageOnEdit(RequestContext context) |
|
65 | { |
|
66 | 0 | return false; |
67 | } |
|
68 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |