Skip to content

Commit

Permalink
Removed default group "Projectmanagers".
Browse files Browse the repository at this point in the history
Use the PROJECT_MANAGER role instead of the group if required.
Fixed some test cases where a wrong import path was used.
  • Loading branch information
aKandzior committed Sep 4, 2014
1 parent c5af9bd commit 4753a58
Show file tree
Hide file tree
Showing 26 changed files with 321 additions and 497 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.opencms.util.CmsUUID;
import org.opencms.widgets.CmsCheckboxWidget;
import org.opencms.widgets.CmsDisplayWidget;
import org.opencms.widgets.CmsGroupWidget;
import org.opencms.widgets.CmsInputWidget;
import org.opencms.widgets.CmsTextareaWidget;
import org.opencms.workplace.CmsDialog;
Expand Down Expand Up @@ -112,8 +111,6 @@ public void actionCommit() {
m_group.getDescription(),
m_group.isEnabled() ? I_CmsPrincipal.FLAG_ENABLED : I_CmsPrincipal.FLAG_DISABLED,
getParentGroup());
newGroup.setProjectManager(m_group.isProjectManager());
newGroup.setProjectCoWorker(m_group.isProjectCoWorker());
m_group = newGroup;
} else {
if (getParentGroup() != null) {
Expand Down Expand Up @@ -342,12 +339,6 @@ protected void defineWidgets() {

// initialize the user object to use for the dialog
initGroupObject();
boolean webuserOu = false;
try {
webuserOu = OpenCms.getOrgUnitManager().readOrganizationalUnit(getCms(), getParamOufqn()).hasFlagWebuser();
} catch (CmsException e) {
// ignore
}
setKeyPrefix(KEY_PREFIX);

// widgets to display
Expand All @@ -358,25 +349,12 @@ protected void defineWidgets() {
}
if (isEditable(m_group)) {
addWidget(new CmsWidgetDialogParameter(this, "description", PAGES[0], new CmsTextareaWidget()));
addWidget(new CmsWidgetDialogParameter(this, "parentGroup", PAGES[0], new CmsGroupWidget(
null,
null,
getParamOufqn())));
addWidget(new CmsWidgetDialogParameter(this, "assignedOu", PAGES[0], new CmsDisplayWidget()));
addWidget(new CmsWidgetDialogParameter(m_group, "enabled", PAGES[0], new CmsCheckboxWidget()));
if (!webuserOu) {
addWidget(new CmsWidgetDialogParameter(m_group, "projectManager", PAGES[0], new CmsCheckboxWidget()));
addWidget(new CmsWidgetDialogParameter(m_group, "projectCoWorker", PAGES[0], new CmsCheckboxWidget()));
}
} else {
addWidget(new CmsWidgetDialogParameter(this, "description", PAGES[0], new CmsDisplayWidget()));
addWidget(new CmsWidgetDialogParameter(this, "parentGroup", PAGES[0], new CmsDisplayWidget()));
addWidget(new CmsWidgetDialogParameter(this, "assignedOu", PAGES[0], new CmsDisplayWidget()));
addWidget(new CmsWidgetDialogParameter(m_group, "enabled", PAGES[0], new CmsDisplayWidget()));
if (!webuserOu) {
addWidget(new CmsWidgetDialogParameter(m_group, "projectManager", PAGES[0], new CmsDisplayWidget()));
addWidget(new CmsWidgetDialogParameter(m_group, "projectCoWorker", PAGES[0], new CmsDisplayWidget()));
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import org.opencms.main.OpenCms;
import org.opencms.security.CmsOrganizationalUnit;
import org.opencms.security.CmsRole;
import org.opencms.security.I_CmsPrincipal;
import org.opencms.util.CmsFileUtil;
import org.opencms.util.CmsStringUtil;
import org.opencms.util.CmsUUID;
Expand Down Expand Up @@ -190,10 +189,7 @@ public String getAssignedOu() {
if (!isNewProject()) {
ou = OpenCms.getOrgUnitManager().readOrganizationalUnit(getCms(), m_project.getOuFqn());
} else {
ou = (CmsOrganizationalUnit)OpenCms.getRoleManager().getOrgUnitsForRole(
getCms(),
CmsRole.PROJECT_MANAGER,
true).get(0);
ou = OpenCms.getRoleManager().getOrgUnitsForRole(getCms(), CmsRole.PROJECT_MANAGER, true).get(0);
}
return ou.getDisplayName(getLocale());
} catch (CmsException e) {
Expand Down Expand Up @@ -428,8 +424,7 @@ protected void defineWidgets() {
addWidget(new CmsWidgetDialogParameter(this, "name", PAGES[0], new CmsDisplayWidget()));
}
addWidget(new CmsWidgetDialogParameter(m_project, "description", "", PAGES[0], new CmsTextareaWidget(), 0, 1));
addWidget(new CmsWidgetDialogParameter(this, "managerGroup", PAGES[0], new CmsGroupWidget(new Integer(
I_CmsPrincipal.FLAG_GROUP_PROJECT_MANAGER), null)));
addWidget(new CmsWidgetDialogParameter(this, "managerGroup", PAGES[0], new CmsGroupWidget(null, null)));
addWidget(new CmsWidgetDialogParameter(this, "userGroup", PAGES[0], new CmsGroupWidget(null, null)));
if (isNewProject()) {
int ous = 1;
Expand Down
15 changes: 3 additions & 12 deletions src/org/opencms/configuration/CmsSystemConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -1021,15 +1021,14 @@ public void addXmlDigesterRules(Digester digester) {
digester.addCallParam("*/" + N_SYSTEM + "/" + N_RUNTIMECLASSES + "/" + N_RUNTIMEINFO, 0, A_CLASS);

// add default users rule
digester.addCallMethod("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS, "setCmsDefaultUsers", 8);
digester.addCallMethod("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS, "setCmsDefaultUsers", 7);
digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_ADMIN, 0);
digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_GUEST, 1);
digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_EXPORT, 2);
digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_USER_DELETEDRESOURCE, 3);
digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_ADMINISTRATORS, 4);
digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_PROJECTMANAGERS, 5);
digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_USERS, 6);
digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_GUESTS, 7);
digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_USERS, 5);
digester.addCallParam("*/" + N_SYSTEM + "/" + N_DEFAULTUSERS + "/" + N_GROUP_GUESTS, 6);

// add defaultContentEncoding rule
digester.addCallMethod("*/" + N_SYSTEM + "/" + N_DEFAULT_CONTENT_ENCODING, "setDefaultContentEncoding", 1);
Expand Down Expand Up @@ -1466,8 +1465,6 @@ public Element generateXml(Element parent) {
}
// create <group-administrators> subnode
defaultusersElement.addElement(N_GROUP_ADMINISTRATORS).addText(m_cmsDefaultUsers.getGroupAdministrators());
// create <group-projectmanagers> subnode
defaultusersElement.addElement(N_GROUP_PROJECTMANAGERS).addText(m_cmsDefaultUsers.getGroupProjectmanagers());
// create <group-users> subnode
defaultusersElement.addElement(N_GROUP_USERS).addText(m_cmsDefaultUsers.getGroupUsers());
// create <group-guests> subnode
Expand Down Expand Up @@ -2267,7 +2264,6 @@ public void setCacheSettings(CmsCacheSettings settings) {
* @param userExport the name of the export user
* @param userDeletedResource the name of the deleted resource user, can be <code>null</code>
* @param groupAdministrators the name of the administrators group
* @param groupProjectmanagers the name of the project managers group
* @param groupUsers the name of the users group
* @param groupGuests the name of the guests group
*/
Expand All @@ -2278,7 +2274,6 @@ public void setCmsDefaultUsers(
String userExport,
String userDeletedResource,
String groupAdministrators,
String groupProjectmanagers,
String groupUsers,
String groupGuests) {

Expand All @@ -2291,7 +2286,6 @@ public void setCmsDefaultUsers(
userExport,
userDeletedResource,
groupAdministrators,
groupProjectmanagers,
groupUsers,
groupGuests);

Expand All @@ -2311,9 +2305,6 @@ public void setCmsDefaultUsers(
CmsLog.INIT.info(Messages.get().getBundle().key(
Messages.INIT_ADMIN_GROUP_1,
m_cmsDefaultUsers.getGroupAdministrators()));
CmsLog.INIT.info(Messages.get().getBundle().key(
Messages.INIT_PROJECT_MANAGERS_GROUP_1,
m_cmsDefaultUsers.getGroupProjectmanagers()));
CmsLog.INIT.info(Messages.get().getBundle().key(
Messages.INIT_USERS_GROUP_1,
m_cmsDefaultUsers.getGroupUsers()));
Expand Down
2 changes: 1 addition & 1 deletion src/org/opencms/configuration/opencms-system.dtd
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ Each job can have an optional list of parameters.
# Provides access to the names of the OpenCms default users and groups.
-->

<!ELEMENT defaultusers (user-admin, user-guest, user-export, user-deletedresource?, group-administrators, group-projectmanagers, group-users, group-guests)>
<!ELEMENT defaultusers (user-admin, user-guest, user-export, user-deletedresource?, group-administrators, group-projectmanagers?, group-users, group-guests)>

<!ELEMENT user-admin (#PCDATA)>
<!ELEMENT user-guest (#PCDATA)>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import org.opencms.i18n.CmsLocaleManager;
import org.opencms.main.CmsContextInfo;

// TODO: Auto-generated Javadoc
/**
* Bean used to access the built-in preferences via reflection.<p>
*
Expand Down
34 changes: 8 additions & 26 deletions src/org/opencms/db/CmsDefaultUsers.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ public class CmsDefaultUsers {
/** Default name for the "Guests" group. */
protected static final String DEFAULT_GROUP_GUESTS = "Guests";

/** Default name for the "Projectmanagers" group. */
protected static final String DEFAULT_GROUP_PROJECTMANAGERS = "Projectmanagers";

/** Default name for the "Users" group. */
protected static final String DEFAULT_GROUP_USERS = "Users";

Expand All @@ -68,9 +65,6 @@ public class CmsDefaultUsers {
/** Guests group name. */
private String m_groupGuests;

/** Project Managers group name. */
private String m_groupProjectmanagers;

/** System Users group name. */
private String m_groupUsers;

Expand Down Expand Up @@ -98,7 +92,6 @@ public CmsDefaultUsers() {
m_userExport = DEFAULT_USER_EXPORT;
m_userDeletedResource = DEFAULT_USER_DELETED_RESOURCE;
m_groupAdministrators = DEFAULT_GROUP_ADMINISTRATORS;
m_groupProjectmanagers = DEFAULT_GROUP_PROJECTMANAGERS;
m_groupUsers = DEFAULT_GROUP_USERS;
m_groupGuests = DEFAULT_GROUP_GUESTS;
}
Expand All @@ -111,7 +104,6 @@ public CmsDefaultUsers() {
* @param userExport the name of the export user
* @param userDeletedResource the name of the deleted resource user, can be <code>null</code>
* @param groupAdministrators the name of the administrators group
* @param groupProjectmanagers the name of the project managers group
* @param groupUsers the name of the users group
* @param groupGuests the name of the guests group
*/
Expand All @@ -121,19 +113,10 @@ public CmsDefaultUsers(
String userExport,
String userDeletedResource,
String groupAdministrators,
String groupProjectmanagers,
String groupUsers,
String groupGuests) {

init(
userAdmin,
userGuest,
userExport,
userDeletedResource,
groupAdministrators,
groupProjectmanagers,
groupUsers,
groupGuests);
init(userAdmin, userGuest, userExport, userDeletedResource, groupAdministrators, groupUsers, groupGuests);
}

/**
Expand All @@ -160,10 +143,16 @@ public String getGroupGuests() {
* Returns the name of the project managers group.<p>
*
* @return the name of the project managers group
*
* @deprecated
* As of OpenCms 9.5, there is no default group for project managers anymore.
* Use the role {@link org.opencms.security.CmsRole#PROJECT_MANAGER} instead in case you want a user to be able to manage projects.
* For backward compatibility in old installations, this returns the old default group name "Projectmanagers".
*/
@Deprecated
public String getGroupProjectmanagers() {

return m_groupProjectmanagers;
return "Projectmanagers";
}

/**
Expand Down Expand Up @@ -224,7 +213,6 @@ public String getUserGuest() {
* or if <code>groupName</code> is <code>null</code> or an empty string (no trim)
*
* @see #getGroupAdministrators()
* @see #getGroupProjectmanagers()
* @see #getGroupUsers()
* @see #getGroupGuests()
*/
Expand All @@ -237,13 +225,11 @@ public boolean isDefaultGroup(String groupName) {
// first check without ou prefix, to stay backwards compatible
boolean isDefault = m_groupAdministrators.equals(groupName);
isDefault = isDefault || m_groupGuests.equals(groupName);
isDefault = isDefault || m_groupProjectmanagers.equals(groupName);
isDefault = isDefault || m_groupUsers.equals(groupName);

// now check with ou prefix
isDefault = isDefault || groupName.endsWith(CmsOrganizationalUnit.SEPARATOR + m_groupAdministrators);
isDefault = isDefault || groupName.endsWith(CmsOrganizationalUnit.SEPARATOR + m_groupGuests);
isDefault = isDefault || groupName.endsWith(CmsOrganizationalUnit.SEPARATOR + m_groupProjectmanagers);
isDefault = isDefault || groupName.endsWith(CmsOrganizationalUnit.SEPARATOR + m_groupUsers);

return isDefault;
Expand Down Expand Up @@ -351,7 +337,6 @@ public boolean isUserGuest(String userName) {
* @param userExport the name of the export user
* @param userDeletedResource the name of the deleted resource user, can be <code>null</code>
* @param groupAdministrators the name of the administrators group
* @param groupProjectmanagers the name of the project managers group
* @param groupUsers the name of the users group
* @param groupGuests the name of the guests group
*/
Expand All @@ -361,7 +346,6 @@ protected void init(
String userExport,
String userDeletedResource,
String groupAdministrators,
String groupProjectmanagers,
String groupUsers,
String groupGuests) {

Expand All @@ -370,7 +354,6 @@ protected void init(
|| CmsStringUtil.isEmptyOrWhitespaceOnly(userGuest)
|| CmsStringUtil.isEmptyOrWhitespaceOnly(userExport)
|| CmsStringUtil.isEmptyOrWhitespaceOnly(groupAdministrators)
|| CmsStringUtil.isEmptyOrWhitespaceOnly(groupProjectmanagers)
|| CmsStringUtil.isEmptyOrWhitespaceOnly(groupUsers)
|| CmsStringUtil.isEmptyOrWhitespaceOnly(groupGuests)) {
throw new CmsRuntimeException(Messages.get().container(Messages.ERR_USER_GROUP_NAMES_EMPTY_0));
Expand All @@ -385,7 +368,6 @@ protected void init(
m_userDeletedResource = userDeletedResource.trim();
}
m_groupAdministrators = groupAdministrators.trim();
m_groupProjectmanagers = groupProjectmanagers.trim();
m_groupUsers = groupUsers.trim();
m_groupGuests = groupGuests.trim();
}
Expand Down
5 changes: 1 addition & 4 deletions src/org/opencms/db/generic/CmsProjectDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -695,9 +695,6 @@ public void fillDefaults(CmsDbContext dbc) throws CmsDataAccessException {
String usersGroup = OpenCms.getDefaultUsers().getGroupUsers();
CmsGroup users = m_driverManager.readGroup(dbc, usersGroup);

String projectmanagersGroup = OpenCms.getDefaultUsers().getGroupProjectmanagers();
CmsGroup projectmanager = m_driverManager.readGroup(dbc, projectmanagersGroup);

////////////////////////////////////////////////////////////////////////////////////////////
// online project stuff
////////////////////////////////////////////////////////////////////////////////////////////
Expand All @@ -708,7 +705,7 @@ public void fillDefaults(CmsDbContext dbc) throws CmsDataAccessException {
CmsProject.ONLINE_PROJECT_ID,
admin,
users,
projectmanager,
administrators,
CmsProject.ONLINE_PROJECT_NAME,
"The Online project",
I_CmsPrincipal.FLAG_ENABLED,
Expand Down
23 changes: 1 addition & 22 deletions src/org/opencms/db/generic/CmsUserDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -2192,12 +2192,6 @@ protected void internalCreateDefaultGroups(CmsDbContext dbc, String ouFqn, Strin
}
String groupName = ouFqn + role.getGroupName();
int flags = I_CmsPrincipal.FLAG_ENABLED | I_CmsPrincipal.FLAG_GROUP_ROLE;
if ((role == CmsRole.WORKPLACE_USER) || (role == CmsRole.PROJECT_MANAGER)) {
flags |= I_CmsPrincipal.FLAG_GROUP_PROJECT_USER;
}
if (role == CmsRole.PROJECT_MANAGER) {
flags |= I_CmsPrincipal.FLAG_GROUP_PROJECT_MANAGER;
}
createGroup(dbc, CmsUUID.getConstantUUID(groupName), groupName, "A system role group", flags, null);

}
Expand All @@ -2221,7 +2215,6 @@ protected void internalCreateDefaultGroups(CmsDbContext dbc, String ouFqn, Strin
String administratorsGroup = ouFqn + OpenCms.getDefaultUsers().getGroupAdministrators();
String guestGroup = ouFqn + OpenCms.getDefaultUsers().getGroupGuests();
String usersGroup = ouFqn + OpenCms.getDefaultUsers().getGroupUsers();
String projectmanagersGroup = ouFqn + OpenCms.getDefaultUsers().getGroupProjectmanagers();
String guestUser = ouFqn + OpenCms.getDefaultUsers().getUserGuest();
String adminUser = ouFqn + OpenCms.getDefaultUsers().getUserAdmin();
String exportUser = ouFqn + OpenCms.getDefaultUsers().getUserExport();
Expand All @@ -2232,7 +2225,6 @@ protected void internalCreateDefaultGroups(CmsDbContext dbc, String ouFqn, Strin
// check the flags of existing groups, for compatibility checks
internalUpdateRoleGroup(dbc, administratorsGroup, CmsRole.ROOT_ADMIN);
internalUpdateRoleGroup(dbc, usersGroup, CmsRole.WORKPLACE_USER.forOrgUnit(ouFqn));
internalUpdateRoleGroup(dbc, projectmanagersGroup, CmsRole.PROJECT_MANAGER.forOrgUnit(ouFqn));
}
return;
}
Expand All @@ -2248,7 +2240,6 @@ protected void internalCreateDefaultGroups(CmsDbContext dbc, String ouFqn, Strin
Messages.GUI_DEFAULTGROUP_ROOT_USERS_DESCRIPTION_0,
null));
createGroup(dbc, CmsUUID.getConstantUUID(usersGroup), usersGroup, groupDescription, I_CmsPrincipal.FLAG_ENABLED
| I_CmsPrincipal.FLAG_GROUP_PROJECT_USER
| CmsRole.WORKPLACE_USER.getVirtualGroupFlags(), parentGroup);

if (parentOu != null) {
Expand All @@ -2270,21 +2261,9 @@ protected void internalCreateDefaultGroups(CmsDbContext dbc, String ouFqn, Strin
CmsUUID.getConstantUUID(administratorsGroup),
administratorsGroup,
CmsMacroResolver.localizedKeyMacro(Messages.GUI_DEFAULTGROUP_ROOT_ADMINS_DESCRIPTION_0, null),
I_CmsPrincipal.FLAG_ENABLED | I_CmsPrincipal.FLAG_GROUP_PROJECT_MANAGER | flags,
I_CmsPrincipal.FLAG_ENABLED | flags,
null);

parentGroup = ouFqn + OpenCms.getDefaultUsers().getGroupUsers();
createGroup(
dbc,
CmsUUID.getConstantUUID(projectmanagersGroup),
projectmanagersGroup,
CmsMacroResolver.localizedKeyMacro(Messages.GUI_DEFAULTGROUP_ROOT_PROJMANS_DESCRIPTION_0, null),
I_CmsPrincipal.FLAG_ENABLED
| I_CmsPrincipal.FLAG_GROUP_PROJECT_MANAGER
| I_CmsPrincipal.FLAG_GROUP_PROJECT_USER
| CmsRole.PROJECT_MANAGER.getVirtualGroupFlags(),
parentGroup);

CmsUser guest = createUser(
dbc,
CmsUUID.getConstantUUID(guestUser),
Expand Down
Loading

0 comments on commit 4753a58

Please sign in to comment.