Restores some functions of the BaseRoleForm.
It can again check for duplicated names between roles, but uses modern Java™ git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4321 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
2698e67618
commit
cc84642782
|
|
@ -30,13 +30,13 @@ import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ui.BaseForm;
|
import com.arsdigita.cms.ui.BaseForm;
|
||||||
import com.arsdigita.cms.util.SecurityConstants;
|
import com.arsdigita.cms.util.SecurityConstants;
|
||||||
import com.arsdigita.globalization.GlobalizedMessage;
|
import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
|
import com.arsdigita.ui.admin.GlobalizationUtil;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.libreccm.security.Role;
|
import org.libreccm.security.Role;
|
||||||
import org.librecms.contentsection.ContentSection;
|
import org.librecms.contentsection.ContentSection;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.*;
|
||||||
import java.util.TooManyListenersException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For more detailed information see {@link com.arsdigita.bebop.Form}.
|
* For more detailed information see {@link com.arsdigita.bebop.Form}.
|
||||||
|
|
@ -111,6 +111,9 @@ public class BaseRoleForm extends BaseForm {
|
||||||
m_role = role;
|
m_role = role;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validates that there are no duplicates between the names of roles.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public final void validate(final ParameterEvent e)
|
public final void validate(final ParameterEvent e)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
|
|
@ -119,32 +122,17 @@ public class BaseRoleForm extends BaseForm {
|
||||||
CMS.getContext().getContentSection();
|
CMS.getContext().getContentSection();
|
||||||
final String name = (String) m_name.getValue(state);
|
final String name = (String) m_name.getValue(state);
|
||||||
|
|
||||||
Collection<Role> roles;
|
Collection<Role> roles = section.getRoles();
|
||||||
|
|
||||||
/*
|
for (Role role : roles) {
|
||||||
if (m_useViewersGroup) {
|
if (role.getName().equalsIgnoreCase(name)
|
||||||
roles = section.getViewersGroup().getRoles();
|
|
||||||
} else {
|
|
||||||
roles = section.getStaffGroup().getRoles();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
while (roles.next()) {
|
|
||||||
final Role role = roles.getRole();
|
|
||||||
|
|
||||||
if (roles.getRole().getName().equalsIgnoreCase(name)
|
|
||||||
&& (m_role == null
|
&& (m_role == null
|
||||||
|| !m_role.getRole(state).equals(role))) {
|
|| !m_role.getRole(state).equals(role))) {
|
||||||
roles.close();
|
|
||||||
|
|
||||||
throw new FormProcessException
|
throw new FormProcessException
|
||||||
(GlobalizationUtil.globalize("cms.ui.role.name_not_unique"));
|
(GlobalizationUtil.globalize("cms.ui.role.name_not_unique"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
roles.close();
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,6 +105,7 @@ final class RoleEditForm extends BaseRoleForm {
|
||||||
|
|
||||||
role.save();*/
|
role.save();*/
|
||||||
|
|
||||||
|
// TODO This could be terribly wrong. Needs confirmation.
|
||||||
List<Permission> newPermissions = new ArrayList<>();
|
List<Permission> newPermissions = new ArrayList<>();
|
||||||
String[] selectedPermissions = (String[]) m_privileges.getValue(state);
|
String[] selectedPermissions = (String[]) m_privileges.getValue(state);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue