Changes behavior in BaseRoleItemPane to throw an Exception when there are not the right privileges.

Also adds a new value to the CmsResources.

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4363 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
baka 2016-10-06 13:18:46 +00:00
parent 72947f72d7
commit 1674b94ffd
7 changed files with 18 additions and 15 deletions

View File

@ -18,19 +18,14 @@
*/
package com.arsdigita.cms.ui.role;
import com.arsdigita.bebop.ActionLink;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.SingleSelectionModel;
import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.*;
import com.arsdigita.bebop.event.TableActionAdapter;
import com.arsdigita.bebop.event.TableActionEvent;
import com.arsdigita.bebop.table.DefaultTableCellRenderer;
import com.arsdigita.cms.ui.BaseItemPane;
import com.arsdigita.cms.ui.PartySearchForm;
import com.arsdigita.cms.ui.VisibilityComponent;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.kernel.KernelConfig;
import com.arsdigita.toolbox.ui.ActionGroup;
import com.arsdigita.toolbox.ui.PropertyList;
@ -180,12 +175,17 @@ class BaseRoleItemPane extends BaseItemPane {
private class Listener extends TableActionAdapter {
@Override
public final void cellSelected(final TableActionEvent e) {
public final void cellSelected(final TableActionEvent e) throws FormProcessException {
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final PageState state = e.getPageState();
final PermissionChecker permissionChecker = cdiUtil.findBean(PermissionChecker.class);
if (e.getColumn() == 2 && permissionChecker.isPermitted(CmsConstants.PRIVILEGE_ADMINISTER_ROLES)) {
if (!permissionChecker.isPermitted(CmsConstants.PRIVILEGE_ADMINISTER_ROLES)) {
throw new FormProcessException(
new GlobalizedMessage("cms.ui.role.insufficient_privileges", CmsConstants.CMS_BUNDLE));
}
if (e.getColumn() == 2) {
final Role role = m_role.getRole(state);
long itemId = Long.parseLong(e.getRowKey().toString());

View File

@ -25,7 +25,6 @@ import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.ui.admin.GlobalizationUtil;
import org.apache.log4j.Logger;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.core.EmailAddress;
import org.libreccm.security.Party;
import org.libreccm.security.PartyRepository;
import org.libreccm.security.Role;

View File

@ -1,3 +1,4 @@
contentsection.ui.admin.app_note=The properties for a Content Section are managed a special application:
contentsection.ui.admin.link_app=Go to Content Section application
cms.ui.role.insufficient_privileges=The user is not permitted to administrate roles.

View File

@ -1,3 +1,4 @@
contentsection.ui.admin.app_note=Die Verwaltung von Content Sections erfolgt \u00fcber eine eigene Application:
contentsection.ui.admin.link_app=Zur Content Section Applikation
cms.ui.role.insufficient_privileges=Der Benutzer ist nicht privilegiert Rollen zu administrieren.

View File

@ -225,7 +225,7 @@ public class Table extends SimpleComponent {
* @param column the integer index of the selected column
*/
protected void fireCellSelected(PageState state,
Object rowKey, Integer column) {
Object rowKey, Integer column) throws FormProcessException {
Iterator i = m_listeners.getListenerIterator(TableActionListener.class);
TableActionEvent e = null;

View File

@ -18,6 +18,8 @@
*/
package com.arsdigita.bebop.event;
import com.arsdigita.bebop.FormProcessException;
/**
* An implentation of the TableActionListener interface meant to save the
* developer from having to override both the {@link
@ -36,9 +38,7 @@ public class TableActionAdapter implements TableActionListener {
*
* @param e the event fired for the table.
*/
public void cellSelected(TableActionEvent e) {
return;
}
public void cellSelected(TableActionEvent e) throws FormProcessException {}
/**
* A no-op implementation of {@link

View File

@ -18,6 +18,8 @@
*/
package com.arsdigita.bebop.event;
import com.arsdigita.bebop.FormProcessException;
import java.util.EventListener;
/**
@ -39,7 +41,7 @@ public interface TableActionListener extends EventListener {
*
* @param e the event fired for the table.
*/
void cellSelected(TableActionEvent e);
void cellSelected(TableActionEvent e) throws FormProcessException;
/**
* An event handler for actions on a particular column heading or