/** * ロールをデータベースから読み出します。 <br> * * @param rundata * @param context * @param msgList * @return TRUE 成功 FALSE 失敗 */ @Override protected boolean loadFormData(RunData rundata, Context context, List<String> msgList) { try { // オブジェクトモデルを取得 EipTAclRole aclrole = AccessControlUtils.getEipTAclRole(rundata, context); if (aclrole == null) { return false; } // ロール名 acl_role_name.setValue(aclrole.getRoleName()); List<EipTAclUserRoleMap> aclUserRoleMaps = AccessControlUtils.getEipTAclUserRoleMaps(aclrole.getRoleId().intValue()); if (aclUserRoleMaps != null && aclUserRoleMaps.size() > 0) { EipTAclUserRoleMap rolemap = null; TurbineUser tuser = null; int size = aclUserRoleMaps.size(); for (int i = 0; i < size; i++) { rolemap = aclUserRoleMaps.get(i); tuser = rolemap.getTurbineUser(); ALEipUser user = new ALEipUser(); user.initField(); user.setUserId(tuser.getUserId().intValue()); user.setName(tuser.getLoginName()); user.setAliasName(tuser.getFirstName(), tuser.getLastName()); // 招待中ユーザでなければ追加 if (!JetspeedResources.CONFIRM_VALUE_PENDING.equals(tuser.getConfirmValue())) { memberList.add(user); } } } EipTAclPortletFeature feature = aclrole.getEipTAclPortletFeature(); feature_id.setValue(feature.getFeatureId().intValue()); defineAclType = feature.getAclType().intValue(); // メモ note.setValue(aclrole.getNote()); // アクセス権限 int tmpAclType = aclrole.getAclType(); AccessControlUtils.setupAcl(ALAccessControlConstants.VALUE_ACL_LIST, tmpAclType, acllist); AccessControlUtils.setupAcl(ALAccessControlConstants.VALUE_ACL_DETAIL, tmpAclType, acldetail); AccessControlUtils.setupAcl(ALAccessControlConstants.VALUE_ACL_INSERT, tmpAclType, aclinsert); AccessControlUtils.setupAcl(ALAccessControlConstants.VALUE_ACL_UPDATE, tmpAclType, aclupdate); AccessControlUtils.setupAcl(ALAccessControlConstants.VALUE_ACL_DELETE, tmpAclType, acldelete); AccessControlUtils.setupAcl(ALAccessControlConstants.VALUE_ACL_EXPORT, tmpAclType, aclexport); } catch (Exception ex) { logger.error("AccessControlFormData.loadFormData", ex); return false; } return true; }
public Map<String, EipTAclRole> getAclRoleMap(int userId) { HttpServletRequest request = HttpServletRequestLocator.get(); if (request != null) { // requestから取得 @SuppressWarnings("unchecked") Map<String, EipTAclRole> map = (Map<String, EipTAclRole>) request.getAttribute(ACL_KEY); if (map != null) { return map; } } // データベースから新規取得 Map<String, EipTAclRole> roleMap = new HashMap<String, EipTAclRole>(); Expression exp = ExpressionFactory.matchDbExp( EipTAclRole.EIP_TACL_USER_ROLE_MAPS_PROPERTY + "." + EipTAclUserRoleMap.TURBINE_USER_PROPERTY + "." + TurbineUser.USER_ID_PK_COLUMN, userId); List<EipTAclRole> roleList = Database.query(EipTAclRole.class, exp).fetchList(); List<EipTAclPortletFeature> featureList = Database.query(EipTAclPortletFeature.class).fetchList(); Map<Integer, String> _map = new HashMap<Integer, String>(); for (EipTAclPortletFeature feature : featureList) { _map.put(feature.getFeatureId(), feature.getFeatureName()); } String _featureName; for (EipTAclRole _role : roleList) { _featureName = _map.get(_role.getFeatureId()); roleMap.put(_featureName, _role); } // requestに登録 if (request != null) { request.setAttribute(ACL_KEY, roleMap); } return roleMap; }