最後に、フックプラグインを使用して、RoleXの変更とinitusers_adminポートレットjspファイルの変更を行うことができましたResource Permissions
。
主な問題は、LiferayがResourcePermissionsを使用して、ユーザーが所属する組織以外の組織管理を有効にしていないことでした。
特に、会社の管理者ロールに対してのみportal-trunk/portal-web/docroot/html/portlet/users_admin/init.jsp
有効にするコード行が数行あります。
else if (permissionChecker.isCompanyAdmin()) {
filterManageableGroups = false;
filterManageableOrganizations = false;
filterManageableUserGroups = false;
}
そこで、次の行をinit.jsp(フックでinit-ext.jspを使用できます)に追加して、RoleXでも有効にしました。
if (MyUtils.isRoleX()) {
filterManageableGroups = false;
filterManageableOrganizations = false;
filterManageableUserGroups = false;
}
このように、データベースクエリは、組織、ユーザー、およびグループをフィルタリングしません。
2番目のステップは、追加、更新、管理などの権限を定義することです。ユーザーと組織、およびコントロールパネルのポートレットへのアクセス。
ResourcePermisssionLocalService
これは、スタートアップアクションフックとAPIを使用すると非常に簡単でした。
private static final String[] ORGANIZATION_ENTRY_ACTION_IDS = new String[] {
ActionKeys.VIEW, ActionKeys.UPDATE, ActionKeys.ASSIGN_USER_ROLES,
ActionKeys.DELETE, ActionKeys.MANAGE_USERS };
private static final String[] ORGANIZATION_CUSTOM_FIELDS_ENTRY_ACTION_IDS = new String[] {
ActionKeys.VIEW, ActionKeys.UPDATE };
public static final String[] ORGANIZATION_MODEL_ACTION_IDS = new String[] {
ActionKeys.ASSIGN_MEMBERS, ActionKeys.ASSIGN_USER_ROLES,
ActionKeys.DELETE, ActionKeys.MANAGE_ANNOUNCEMENTS,
ActionKeys.UPDATE, ActionKeys.VIEW, ActionKeys.MANAGE_USERS,
ActionKeys.MANAGE_SUBORGANIZATIONS };
public static final String[] ORGANIZATION_GROUP_ENTRY_ACTION_IDS = new String[] {
ActionKeys.ASSIGN_MEMBERS, ActionKeys.ASSIGN_USER_ROLES,
ActionKeys.UPDATE, ActionKeys.VIEW, ActionKeys.VIEW_MEMBERS };
private static final String[] PORTAL_ACTION_IDS = new String[] {
ActionKeys.ADD_USER, ActionKeys.ADD_ORGANIZATION,
ActionKeys.VIEW_CONTROL_PANEL };
private static final String[] USERS_ORG_ADMIN_ACTION_IDS = new String[] { ActionKeys.ACCESS_IN_CONTROL_PANEL };
...オミシス..。
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId,
Organization.class.getName(),
ResourceConstants.SCOPE_GROUP_TEMPLATE, "0", CiUtils
.getRoleX().getPrimaryKey(),
ORGANIZATION_MODEL_ACTION_IDS);
// ORGANIZATION MODEL COMPANY PERMISSIONS
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId,
Organization.class.getName(), ResourceConstants.SCOPE_COMPANY,
Long.toString(companyId),
CiUtils.getRoleX().getPrimaryKey(),
ORGANIZATION_MODEL_ACTION_IDS);
// PORTAL (portlet 90) PERMISSIONS
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId,
"90", ResourceConstants.SCOPE_COMPANY,
Long.toString(companyId),
CiUtils.getRoleX().getPrimaryKey(),
PORTAL_ACTION_IDS);
// USER_ORG_ADMINS PORTLET (125) PERMISSIONS
ResourcePermissionLocalServiceUtil.setResourcePermissions(companyId,
"125", ResourceConstants.SCOPE_COMPANY,
Long.toString(companyId),
CiUtils.getRoleX().getPrimaryKey(),
USERS_ORG_ADMIN_ACTION_IDS);
および各組織について:
ResourcePermissionLocalServiceUtil.setResourcePermissions(organization.getCompanyId(),
Organization.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL, Long .toString(organization.getPrimaryKey()),
MyUtils.getRoleX().getPrimaryKey(),
ORGANIZATION_ENTRY_ACTION_IDS);
long groupId = organization.getGroupId();
ResourcePermissionLocalServiceUtil.setResourcePermissions(
organization.getCompanyId(),Group.class.getName(), ResourceConstants.SCOPE_INDIVIDUAL,Long.toString(groupId),
MyUtils.getRoleX().getPrimaryKey(),
ORGANIZATION_GROUP_ENTRY_ACTION_IDS);
これが他の誰かを助けることができることを願っています。