1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.seasar.tuigwaa.controller;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.apache.struts.action.ActionForm;
22 import org.seasar.tuigwaa.security.Action;
23 import org.seasar.tuigwaa.security.SecurityService;
24 import org.seasar.tuigwaa.system.SiteConfig;
25
26
27 public class FolderSettingForm extends ActionForm {
28
29 private static final long serialVersionUID = 6620340614498295181L;
30
31 private List roleFlagList = new ArrayList();
32
33 private String siteName;
34
35 private String path;
36
37 private String[] checkedRoleNames;
38
39 public FolderSettingForm(String siteName, String path,
40 SiteConfig siteConfig, SecurityService securityService) {
41 this.siteName = siteName;
42 this.path = path;
43
44 String[] roleNames = siteConfig.getRoleNames();
45
46 for (int i = 0; i < roleNames.length; i++) {
47 Action action = Action.PAGE_VIEW.createParameteredAction(path);
48 boolean flag = securityService.hasPermission(siteName,
49 roleNames[i], action);
50 roleFlagList.add(new RoleFlag(roleNames[i], flag));
51 }
52 }
53
54 public List getRoleFlagList() {
55 return roleFlagList;
56 }
57
58 public void setCheckedRoleNames(String[] roleNames) {
59 this.checkedRoleNames = roleNames;
60 }
61
62 public String[] getCheckedRoleNames() {
63 return checkedRoleNames;
64 }
65
66 public String getSiteName() {
67 return siteName;
68 }
69
70 public String getPath() {
71 return path;
72 }
73
74 public class RoleFlag {
75
76 private String role;
77
78 private boolean flag;
79
80 public RoleFlag(String role, boolean flag) {
81 this.role = role;
82 this.flag = flag;
83 }
84
85 public String getRole() {
86 return role;
87 }
88
89 public boolean isFlag() {
90 return flag;
91 }
92 }
93 }