CCM NG/ccm-cms:

- Privileges from the folder are now applied to new content items 
- Privilieges from the folder are not applied to new assets
- Some improvments for the structure of the asset forms



git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4883 8810af33-2d31-482b-a856-94f89814c4df

Former-commit-id: 64e9b6097b
pull/2/head
jensp 2017-07-24 15:22:10 +00:00
parent 817245af89
commit f9d21c9846
31 changed files with 1822 additions and 649 deletions

View File

@ -77,6 +77,9 @@
<Logger name="org.libreccm.ui.admin.usersgroupsroles.RolesController"
level="debug">
</Logger>
<Logger name="org.librecms.contentsection.AssetRepository"
level="debug">
</Logger>
<Logger name="org.librecms.contentsection.ContentSectionSetup"
level="debug">
</Logger>

View File

@ -47,25 +47,29 @@ import org.librecms.contentsection.AssetRepository;
import java.util.Optional;
import org.libreccm.categorization.CategoryManager;
import org.libreccm.core.UnexpectedErrorException;
import org.librecms.assets.AssetL10NManager;
import org.librecms.contentsection.Folder;
import org.librecms.contentsection.AssetManager;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.TooManyListenersException;
/**
* Basic Form for manipulating assets.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
* @param <T> The type of the asset.
*/
public abstract class AssetForm extends Form implements FormInitListener,
public abstract class AbstractAssetForm<T extends Asset>
extends Form implements FormInitListener,
FormProcessListener,
FormSubmissionListener {
private static final String ASSET_TITLE = "asset-title";
private static final String ASSET_TITLE = "asset-name";
private static final String ASSET_NAME = "asset-title";
private final AssetPane assetPane;
private final SingleSelectionModel<Long> selectionModel;
@ -78,10 +82,11 @@ public abstract class AssetForm extends Form implements FormInitListener,
private SingleSelect addLocaleSelect;
private Submit addLocaleSubmit;
private TextField name;
private TextField title;
private SaveCancelSection saveCancelSection;
public AssetForm(final AssetPane assetPane) {
public AbstractAssetForm(final AssetPane assetPane) {
super("asset-form", new ColumnPanel(1));
this.assetPane = assetPane;
@ -98,7 +103,7 @@ public abstract class AssetForm extends Form implements FormInitListener,
@Override
public void prepare(final PrintEvent event) {
final PageState state = event.getPageState();
final Optional<Asset> selectedAsset = getSelectedAsset(state);
final Optional<T> selectedAsset = getSelectedAsset(state);
final Label target = (Label) event.getTarget();
if (selectedAsset.isPresent()) {
target.setLabel(new GlobalizedMessage(
@ -121,8 +126,7 @@ public abstract class AssetForm extends Form implements FormInitListener,
public void prepare(final PrintEvent event) {
final PageState state = event.getPageState();
final Optional<Asset> selectedAsset
= getSelectedAsset(state);
final Optional<T> selectedAsset = getSelectedAsset(state);
if (selectedAsset.isPresent()) {
final SingleSelect target = (SingleSelect) event
.getTarget();
@ -196,8 +200,7 @@ public abstract class AssetForm extends Form implements FormInitListener,
public void prepare(final PrintEvent event) {
final PageState state = event.getPageState();
final Optional<Asset> selectedAsset
= getSelectedAsset(state);
final Optional<T> selectedAsset = getSelectedAsset(state);
if (selectedAsset.isPresent()) {
final SingleSelect target = (SingleSelect) event
.getTarget();
@ -232,6 +235,11 @@ public abstract class AssetForm extends Form implements FormInitListener,
addLocalePanel.add(addLocaleSubmit);
add(addLocalePanel);
add(new Label(new GlobalizedMessage("cms.ui.asset.name",
CmsConstants.CMS_BUNDLE)));
name = new TextField(ASSET_NAME);
add(name);
add(new Label(new GlobalizedMessage("cms.ui.asset.title",
CmsConstants.CMS_BUNDLE)));
title = new TextField(ASSET_TITLE);
@ -255,7 +263,8 @@ public abstract class AssetForm extends Form implements FormInitListener,
return (String) title.getValue(state);
}
protected Optional<Asset> getSelectedAsset(final PageState state) {
@SuppressWarnings("unchecked")
protected Optional<T> getSelectedAsset(final PageState state) {
if (selectionModel.getSelectedKey(state) == null) {
return Optional.empty();
@ -268,7 +277,17 @@ public abstract class AssetForm extends Form implements FormInitListener,
.orElseThrow(() -> new IllegalArgumentException(String.
format("No asset with ID %d in the database.",
selectionModel.getSelectedKey(state))));
return Optional.of(asset);
if (getAssetClass().isAssignableFrom(asset.getClass())) {
return Optional.of((T) asset);
} else {
throw new UnexpectedErrorException(String
.format(
"The requested asset is not of the type expected by "
+ "this form. Expected type is \"%s\". "
+ "Type of asset: \"%s\".",
getAssetClass().getName(),
asset.getClass().getName()));
}
}
}
@ -277,7 +296,7 @@ public abstract class AssetForm extends Form implements FormInitListener,
final PageState state = event.getPageState();
final Optional<Asset> selectedAsset = getSelectedAsset(state);
final Optional<T> selectedAsset = getSelectedAsset(state);
if (selectedAsset.isPresent()) {
@ -312,8 +331,12 @@ public abstract class AssetForm extends Form implements FormInitListener,
}
}
protected String getTitleValue(final PageState state) {
return (String) title.getValue(state);
}
protected void initForm(final PageState state,
final Optional<Asset> selectedAsset) {
final Optional<T> selectedAsset) {
if (selectedAsset.isPresent()) {
@ -336,18 +359,9 @@ public abstract class AssetForm extends Form implements FormInitListener,
if (showLocaleSubmit.isSelected(state)) {
final Optional<Asset> selectedAsset = getSelectedAsset(state);
final Optional<T> selectedAsset = getSelectedAsset(state);
initForm(state, selectedAsset);
// if (selectedAsset.isPresent()) {
//
// title.setValue(state,
// selectedAsset
// .get()
// .getTitle()
// .getValue(getSelectedLocale(state)));
// showLocale(state);
// }
return;
}
@ -356,52 +370,77 @@ public abstract class AssetForm extends Form implements FormInitListener,
.findBean(AssetL10NManager.class);
final Locale add = new Locale((String) addLocaleSelect
.getValue(state));
final Optional<Asset> selectedAsset = getSelectedAsset(state);
final Optional<T> selectedAsset = getSelectedAsset(state);
l10nManager.addLanguage(selectedAsset.get(), add);
}
if (saveCancelSection.getSaveButton().isSelected(state)) {
final Optional<Asset> selectedAsset = getSelectedAsset(state);
final Optional<T> selectedAsset = getSelectedAsset(state);
final Asset asset;
if (selectedAsset.isPresent()) {
asset = selectedAsset.get();
updateAsset(asset, event);
} else {
asset = createAsset(event);
}
// updateAsset(asset, event);
asset.setDisplayName((String) name.getValue(state));
asset.getTitle().addValue(getSelectedLocale(state),
(String) title.getValue(state));
// final AssetRepository assetRepo = cdiUtil
// .findBean(AssetRepository.class);
// assetRepo.save(asset);
} else {
asset = createAsset(event);
updateAsset(asset, event);
}
updateAsset(asset, event);
final AssetRepository assetRepo = cdiUtil
.findBean(AssetRepository.class);
assetRepo.save(asset);
if (!selectedAsset.isPresent()) {
//Set display name
asset.setDisplayName((String) title.getValue(state));
assetRepo.save(asset);
//Add new asset to currently selected folder
final Folder selectedFolder = assetPane
.getFolderSelectionModel()
.getSelectedObject(state);
final CategoryManager categoryManager = cdiUtil
.findBean(CategoryManager.class);
categoryManager.addObjectToCategory(
asset,
selectedFolder,
CmsConstants.CATEGORIZATION_TYPE_FOLDER);
}
// if (!selectedAsset.isPresent()) {
// //Set display name
// asset.setDisplayName((String) title.getValue(state));
// assetRepo.save(asset);
//
// //Add new asset to currently selected folder
// final Folder selectedFolder = assetPane
// .getFolderSelectionModel()
// .getSelectedObject(state);
// final CategoryManager categoryManager = cdiUtil
// .findBean(CategoryManager.class);
// categoryManager.addObjectToCategory(
// asset,
// selectedFolder,
// CmsConstants.CATEGORIZATION_TYPE_FOLDER);
// }
assetPane.browseMode(state);
}
}
protected abstract Class<T> getAssetClass();
protected abstract void showLocale(final PageState state);
protected abstract Asset createAsset(final FormSectionEvent event)
throws FormProcessException;
protected final T createAsset(final FormSectionEvent event)
throws FormProcessException {
Objects.requireNonNull(event);
final PageState state = event.getPageState();
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
final AssetManager assetManager = cdiUtil.findBean(AssetManager.class);
return assetManager.createAsset((String) name.getValue(state),
(String) title.getValue(state),
getSelectedLocale(state),
assetPane
.getFolderSelectionModel()
.getSelectedObject(state),
getAssetClass());
}
protected abstract void updateAsset(final Asset asset,
final FormSectionEvent event)

View File

@ -21,11 +21,13 @@ package com.arsdigita.cms.ui.assets;
import javax.enterprise.context.RequestScoped;
/**
*
* Controller for the asset forms
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
public class AssetFormController {
class AssetFormController {

View File

@ -536,7 +536,7 @@ public class AssetPane extends LayoutPanel implements Resettable {
.findBean(AssetTypesManager.class);
final AssetTypeInfo typeInfo = typesManager
.getAssetTypeInfo(selectedAssetType);
final Class<? extends AssetForm> assetForm = typeInfo
final Class<? extends AbstractAssetForm> assetForm = typeInfo
.getAssetForm();
try {
return assetForm

View File

@ -26,7 +26,7 @@ import com.arsdigita.bebop.Text;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.cms.ui.FileUploadSection;
import com.arsdigita.cms.ui.assets.AssetForm;
import com.arsdigita.cms.ui.assets.AbstractAssetForm;
import com.arsdigita.cms.ui.assets.AssetPane;
import com.arsdigita.globalization.GlobalizedMessage;
@ -45,8 +45,10 @@ import org.librecms.contentsection.Asset;
* Base form for assets which extend {@link BinaryAsset}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
* @param <T> Type of binary asset
*/
public abstract class BinaryAssetForm extends AssetForm {
public abstract class AbstractBinaryAssetForm<T extends BinaryAsset>
extends AbstractAssetForm<T> {
private TextArea description;
private Text fileName;
@ -54,7 +56,7 @@ public abstract class BinaryAssetForm extends AssetForm {
private Text size;
private FileUploadSection fileUpload;
public BinaryAssetForm(final AssetPane assetPane) {
public AbstractBinaryAssetForm(final AssetPane assetPane) {
super(assetPane);
}
@ -101,7 +103,7 @@ public abstract class BinaryAssetForm extends AssetForm {
@Override
protected void initForm(final PageState state,
final Optional<Asset> selectedAsset) {
final Optional<T> selectedAsset) {
super.initForm(state, selectedAsset);
@ -140,7 +142,7 @@ public abstract class BinaryAssetForm extends AssetForm {
@Override
protected void showLocale(final PageState state) {
final Optional<Asset> selectedAsset = getSelectedAsset(state);
final Optional<T> selectedAsset = getSelectedAsset(state);
if (selectedAsset.isPresent()) {
if (!(getSelectedAsset(state).get() instanceof BinaryAsset)) {
@ -158,27 +160,27 @@ public abstract class BinaryAssetForm extends AssetForm {
}
@Override
protected Asset createAsset(final FormSectionEvent event)
throws FormProcessException {
// @Override
// protected Asset createAsset(final FormSectionEvent event)
// throws FormProcessException {
//
// Objects.requireNonNull(event);
//
// final PageState state = event.getPageState();
//
// final BinaryAsset binaryAsset = createBinaryAsset(state);
//
// binaryAsset
// .getDescription()
// .addValue(getSelectedLocale(state),
// (String) description.getValue(state));
//
// setFileData(event, binaryAsset);
//
// return binaryAsset;
// }
Objects.requireNonNull(event);
final PageState state = event.getPageState();
final BinaryAsset binaryAsset = createBinaryAsset(state);
binaryAsset
.getDescription()
.addValue(getSelectedLocale(state),
(String) description.getValue(state));
setFileData(event, binaryAsset);
return binaryAsset;
}
protected abstract BinaryAsset createBinaryAsset(final PageState state);
// protected abstract BinaryAsset createBinaryAsset(final PageState state);
@Override
protected void updateAsset(final Asset asset,

View File

@ -0,0 +1,171 @@
/*
* Copyright (C) 2017 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package com.arsdigita.cms.ui.assets.forms;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormValidationListener;
import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.form.TextField;
import com.arsdigita.cms.ui.assets.AbstractAssetForm;
import com.arsdigita.cms.ui.assets.AssetPane;
import com.arsdigita.globalization.GlobalizedMessage;
import org.librecms.CmsConstants;
import org.librecms.assets.Bookmark;
import org.librecms.contentsection.Asset;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Objects;
import java.util.Optional;
/**
* Abstract base form for all forms for {@link BookmarkAsset}s.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
* @param <T> Type of the Bookmark Asset.
*/
public abstract class AbstractBookmarkForm<T extends Bookmark>
extends AbstractAssetForm<T> {
private TextArea description;
private TextField url;
public AbstractBookmarkForm(final AssetPane assetPane) {
super(assetPane);
}
@Override
protected void addWidgets() {
add(new Label(
new GlobalizedMessage("cms.ui.assets.bookmark.description",
CmsConstants.CMS_BUNDLE)));
description = new TextArea("bookmark-description");
add(description);
add(new Label(new GlobalizedMessage("cms.ui.assets.bookmark.url",
CmsConstants.CMS_BUNDLE)));
url = new TextField("bookmark-url");
add(url);
addValidationListener(new FormValidationListener() {
@Override
public void validate(final FormSectionEvent event)
throws FormProcessException {
final PageState state = event.getPageState();
final FormData data = event.getFormData();
try {
new URL((String) url.getValue(state));
} catch (MalformedURLException ex) {
data.addError(new GlobalizedMessage(
"cms.ui.assets.bookmark.url.malformed",
CmsConstants.CMS_BUNDLE));
}
}
});
}
@Override
protected void initForm(final PageState state,
final Optional<T> selectedAsset) {
if (selectedAsset.isPresent()) {
if (!(selectedAsset.get() instanceof Bookmark)) {
throw new IllegalArgumentException(String.format(
"The provided asset must be an instanceof of class '%s' or "
+ "an subclass but is an instanceof of class '%s'.",
Bookmark.class.getName(),
selectedAsset.get().getClass().getName()));
}
final Bookmark bookmark = selectedAsset.get();
description.setValue(state,
bookmark
.getDescription()
.getValue(getSelectedLocale(state)));
url.setValue(state, bookmark.getUrl());
}
}
@Override
protected void showLocale(final PageState state) {
final Optional<T> selectedAsset = getSelectedAsset(state);
if (selectedAsset.isPresent()) {
if (!(getSelectedAsset(state).get() instanceof Bookmark)) {
throw new IllegalArgumentException(
"Selected asset is not a bookmark");
}
final Bookmark bookmark = selectedAsset.get();
description.setValue(state,
bookmark
.getDescription()
.getValue(getSelectedLocale(state)));
}
}
protected void updateData(final Bookmark bookmark,
final PageState state) {
bookmark
.getDescription()
.addValue(getSelectedLocale(state),
(String) description.getValue(state));
bookmark.setUrl((String) url.getValue(state));
}
@Override
protected void updateAsset(final Asset asset,
final FormSectionEvent event)
throws FormProcessException {
Objects.requireNonNull(asset);
Objects.requireNonNull(event);
final PageState state = event.getPageState();
if (!(asset instanceof Bookmark)) {
throw new IllegalArgumentException(String.format(
"Provided asset is not an instance of class (or sub class of) "
+ "'%s' but is an instance of class '%s'",
Bookmark.class.getName(),
asset.getClass().getName()));
}
final Bookmark bookmark = (Bookmark) asset;
updateData(bookmark, state);
}
}

View File

@ -25,11 +25,11 @@ import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.cms.ui.assets.AssetPane;
import com.arsdigita.cms.ui.assets.AssetSearchWidget;
import com.arsdigita.globalization.GlobalizedMessage;
import org.libreccm.cdi.utils.CdiUtil;
import org.librecms.CmsConstants;
import org.librecms.assets.AudioAsset;
import org.librecms.assets.BinaryAsset;
import org.librecms.assets.Image;
import org.librecms.assets.LegalMetadata;
import org.librecms.contentsection.Asset;
import org.librecms.contentsection.AssetRepository;
@ -39,8 +39,9 @@ import java.util.Optional;
/**
*
* @author <a href="mailto:yannick.buelter@yabue.de">Yannick Bülter</a>
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class AudioForm extends BinaryAssetForm {
public class AudioForm extends AbstractBinaryAssetForm<AudioAsset> {
private AssetSearchWidget assetSearchWidget;
@ -61,13 +62,14 @@ public class AudioForm extends BinaryAssetForm {
}
@Override
protected void initForm(PageState state, Optional<Asset> selectedAsset) {
protected void initForm(final PageState state,
final Optional<AudioAsset> selectedAsset) {
super.initForm(state, selectedAsset);
if (selectedAsset.isPresent()) {
final AudioAsset audioAsset = (AudioAsset) selectedAsset.get();
final AudioAsset audioAsset = selectedAsset.get();
final LegalMetadata legalMetadata = audioAsset
.getLegalMetadata();
@ -78,18 +80,23 @@ public class AudioForm extends BinaryAssetForm {
}
@Override
protected Asset createAsset(final FormSectionEvent event)
throws FormProcessException {
final AudioAsset audioAsset = (AudioAsset) super.createAsset(event);
final PageState state = event.getPageState();
updateData(audioAsset, state);
return audioAsset;
protected Class<AudioAsset> getAssetClass() {
return AudioAsset.class;
}
// @Override
// protected Asset createAsset(final FormSectionEvent event)
// throws FormProcessException {
//
// final AudioAsset audioAsset = (AudioAsset) super.createAsset(event);
//
// final PageState state = event.getPageState();
//
// updateData(audioAsset, state);
//
// return audioAsset;
// }
@Override
protected void updateAsset(final Asset asset,
final FormSectionEvent event)
@ -122,8 +129,8 @@ public class AudioForm extends BinaryAssetForm {
}
}
@Override
protected BinaryAsset createBinaryAsset(final PageState state) {
return new AudioAsset();
}
// @Override
// protected BinaryAsset createBinaryAsset(final PageState state) {
// return new AudioAsset();
// }
}

View File

@ -18,168 +18,159 @@
*/
package com.arsdigita.cms.ui.assets.forms;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormValidationListener;
import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.form.TextField;
import com.arsdigita.cms.ui.assets.AssetForm;
import com.arsdigita.cms.ui.assets.AssetPane;
import com.arsdigita.globalization.GlobalizedMessage;
import org.librecms.CmsConstants;
import org.librecms.assets.Bookmark;
import org.librecms.contentsection.Asset;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Objects;
import java.util.Optional;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class BookmarkForm extends AssetForm {
public class BookmarkForm extends AbstractBookmarkForm<Bookmark> {
private TextArea description;
private TextField url;
// private TextArea description;
// private TextField url;
public BookmarkForm(final AssetPane assetPane) {
super(assetPane);
}
@Override
protected void addWidgets() {
add(new Label(
new GlobalizedMessage("cms.ui.assets.bookmark.description",
CmsConstants.CMS_BUNDLE)));
description = new TextArea("bookmark-description");
add(description);
add(new Label(new GlobalizedMessage("cms.ui.assets.bookmark.url",
CmsConstants.CMS_BUNDLE)));
url = new TextField("bookmark-url");
add(url);
addValidationListener(new FormValidationListener() {
// @Override
// protected void addWidgets() {
//
// add(new Label(
// new GlobalizedMessage("cms.ui.assets.bookmark.description",
// CmsConstants.CMS_BUNDLE)));
// description = new TextArea("bookmark-description");
// add(description);
//
// add(new Label(new GlobalizedMessage("cms.ui.assets.bookmark.url",
// CmsConstants.CMS_BUNDLE)));
// url = new TextField("bookmark-url");
// add(url);
//
// addValidationListener(new FormValidationListener() {
//
// @Override
// public void validate(final FormSectionEvent event)
// throws FormProcessException {
//
// final PageState state = event.getPageState();
// final FormData data = event.getFormData();
//
// try {
// new URL((String) url.getValue(state));
// } catch (MalformedURLException ex) {
// data.addError(new GlobalizedMessage(
// "cms.ui.assets.bookmark.url.malformed",
// CmsConstants.CMS_BUNDLE));
// }
// }
//
// });
//
// }
//
// @Override
// protected void initForm(final PageState state,
// final Optional<Bookmark> selectedAsset) {
//
// if (selectedAsset.isPresent()) {
//
// if (!(selectedAsset.get() instanceof Bookmark)) {
// throw new IllegalArgumentException(String.format(
// "The provided asset must be an instanceof of class '%s' or "
// + "an subclass but is an instanceof of class '%s'.",
// Bookmark.class.getName(),
// selectedAsset.get().getClass().getName()));
// }
//
// final Bookmark bookmark = selectedAsset.get();
//
// description.setValue(state,
// bookmark
// .getDescription()
// .getValue(getSelectedLocale(state)));
// url.setValue(state, bookmark.getUrl());
//
// }
//
// }
//
// @Override
// protected void showLocale(final PageState state) {
// final Optional<Bookmark> selectedAsset = getSelectedAsset(state);
//
// if (selectedAsset.isPresent()) {
// if (!(getSelectedAsset(state).get() instanceof Bookmark)) {
// throw new IllegalArgumentException(
// "Selected asset is not a bookmark");
// }
//
// final Bookmark bookmark = selectedAsset.get();
//
// description.setValue(state,
// bookmark
// .getDescription()
// .getValue(getSelectedLocale(state)));
// }
// }
@Override
public void validate(final FormSectionEvent event)
throws FormProcessException {
final PageState state = event.getPageState();
final FormData data = event.getFormData();
try {
new URL((String) url.getValue(state));
} catch (MalformedURLException ex) {
data.addError(new GlobalizedMessage(
"cms.ui.assets.bookmark.url.malformed",
CmsConstants.CMS_BUNDLE));
}
@SuppressWarnings("unchecked")
protected Class<Bookmark> getAssetClass() {
return Bookmark.class;
}
});
}
@Override
protected void initForm(final PageState state,
final Optional<Asset> selectedAsset) {
if (selectedAsset.isPresent()) {
if (!(selectedAsset.get() instanceof Bookmark)) {
throw new IllegalArgumentException(String.format(
"The provided asset must be an instanceof of class '%s' or "
+ "an subclass but is an instanceof of class '%s'.",
Bookmark.class.getName(),
selectedAsset.get().getClass().getName()));
}
final Bookmark bookmark = (Bookmark) selectedAsset.get();
description.setValue(state,
bookmark
.getDescription()
.getValue(getSelectedLocale(state)));
url.setValue(state, bookmark.getUrl());
}
}
@Override
protected void showLocale(final PageState state) {
final Optional<Asset> selectedAsset = getSelectedAsset(state);
if (selectedAsset.isPresent()) {
if (!(getSelectedAsset(state).get() instanceof Bookmark)) {
throw new IllegalArgumentException(
"Selected asset is not a bookmark");
}
final Bookmark bookmark = (Bookmark) selectedAsset.get();
description.setValue(state,
bookmark
.getDescription()
.getValue(getSelectedLocale(state)));
}
}
@Override
protected Asset createAsset(final FormSectionEvent event)
throws FormProcessException {
Objects.requireNonNull(event);
final PageState state = event.getPageState();
final Bookmark bookmark = new Bookmark();
updateData(bookmark, state);
return bookmark;
}
protected void updateData(final Bookmark bookmark,
final PageState state) {
bookmark
.getDescription()
.addValue(getSelectedLocale(state),
(String) description.getValue(state));
bookmark.setUrl((String) url.getValue(state));
}
@Override
protected void updateAsset(final Asset asset,
final FormSectionEvent event)
throws FormProcessException {
Objects.requireNonNull(asset);
Objects.requireNonNull(event);
final PageState state = event.getPageState();
if (!(asset instanceof Bookmark)) {
throw new IllegalArgumentException(String.format(
"Provided asset is not an instance of class (or sub class of) "
+ "'%s' but is an instance of class '%s'",
Bookmark.class.getName(),
asset.getClass().getName()));
}
final Bookmark bookmark = (Bookmark) asset;
updateData(bookmark, state);
}
// @Override
// protected Asset createAsset(final FormSectionEvent event)
// throws FormProcessException {
//
// Objects.requireNonNull(event);
//
// final PageState state = event.getPageState();
//
// final Bookmark bookmark = new Bookmark();
//
// updateData(bookmark, state);
//
// return bookmark;
// }
// protected void updateData(final Bookmark bookmark,
// final PageState state) {
// bookmark
// .getDescription()
// .addValue(getSelectedLocale(state),
// (String) description.getValue(state));
//
// bookmark.setUrl((String) url.getValue(state));
// }
//
//
// @Override
// protected void updateAsset(final Asset asset,
// final FormSectionEvent event)
// throws FormProcessException {
//
// Objects.requireNonNull(asset);
// Objects.requireNonNull(event);
//
// final PageState state = event.getPageState();
//
// if (!(asset instanceof Bookmark)) {
// throw new IllegalArgumentException(String.format(
// "Provided asset is not an instance of class (or sub class of) "
// + "'%s' but is an instance of class '%s'",
// Bookmark.class.getName(),
// asset.getClass().getName()));
// }
//
// final Bookmark bookmark = (Bookmark) asset;
//
// updateData(bookmark, state);
// }
}

View File

@ -18,13 +18,13 @@
*/
package com.arsdigita.cms.ui.assets.forms;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.cms.ui.assets.AssetPane;
import com.arsdigita.cms.ui.assets.AssetSearchWidget;
import com.arsdigita.globalization.GlobalizedMessage;
import org.libreccm.cdi.utils.CdiUtil;
import org.librecms.CmsConstants;
import org.librecms.assets.Bookmark;
@ -41,7 +41,8 @@ import java.util.Optional;
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
* @author <a href="mailto:yannick.buelter@yabue.de">Yannick Bülter</a>
*/
public class ExternalAudioAssetForm extends BookmarkForm {
public class ExternalAudioAssetForm
extends AbstractBookmarkForm<ExternalAudioAsset> {
private AssetSearchWidget assetSearchWidget;
@ -63,13 +64,12 @@ public class ExternalAudioAssetForm extends BookmarkForm {
@Override
protected void initForm(final PageState state,
final Optional<Asset> selectedAsset) {
final Optional<ExternalAudioAsset> selectedAsset) {
super.initForm(state, selectedAsset);
if (selectedAsset.isPresent()) {
final ExternalAudioAsset externalAudioAsset
= (ExternalAudioAsset) selectedAsset
.get();
= (ExternalAudioAsset) selectedAsset.get();
final LegalMetadata legalMetadata = externalAudioAsset
.getLegalMetadata();
@ -80,21 +80,25 @@ public class ExternalAudioAssetForm extends BookmarkForm {
}
@Override
protected Asset createAsset(final FormSectionEvent event)
throws FormProcessException {
Objects.requireNonNull(event);
final PageState state = event.getPageState();
final ExternalAudioAsset externalAudioAsset = new ExternalAudioAsset();
updateData((Bookmark) externalAudioAsset, state);
updateData(externalAudioAsset, state);
return externalAudioAsset;
protected Class<ExternalAudioAsset> getAssetClass() {
return ExternalAudioAsset.class;
}
// @Override
// protected Asset createAsset(final FormSectionEvent event)
// throws FormProcessException {
//
// Objects.requireNonNull(event);
//
// final PageState state = event.getPageState();
//
// final ExternalAudioAsset externalAudioAsset = new ExternalAudioAsset();
//
// updateData((Bookmark) externalAudioAsset, state);
// updateData(externalAudioAsset, state);
//
// return externalAudioAsset;
// }
protected void updateData(final ExternalAudioAsset externalAudioAsset,
final PageState state) {

View File

@ -18,7 +18,6 @@
*/
package com.arsdigita.cms.ui.assets.forms;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormSectionEvent;
@ -42,7 +41,8 @@ import org.librecms.contentsection.AssetRepository;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ExternalVideoAssetForm extends BookmarkForm {
public class ExternalVideoAssetForm
extends AbstractBookmarkForm<ExternalVideoAsset> {
private AssetSearchWidget assetSearchWidget;
@ -64,7 +64,7 @@ public class ExternalVideoAssetForm extends BookmarkForm {
@Override
protected void initForm(final PageState state,
final Optional<Asset> selectedAsset) {
final Optional<ExternalVideoAsset> selectedAsset) {
super.initForm(state, selectedAsset);
if (selectedAsset.isPresent()) {
@ -81,21 +81,26 @@ public class ExternalVideoAssetForm extends BookmarkForm {
}
@Override
protected Asset createAsset(final FormSectionEvent event)
throws FormProcessException {
Objects.requireNonNull(event);
final PageState state = event.getPageState();
final ExternalVideoAsset externalVideoAsset = new ExternalVideoAsset();
updateData((Bookmark) externalVideoAsset, state);
updateData(externalVideoAsset, state);
return externalVideoAsset;
protected Class<ExternalVideoAsset> getAssetClass() {
return ExternalVideoAsset.class;
}
// @Override
// protected Asset createAsset(final FormSectionEvent event)
// throws FormProcessException {
//
// Objects.requireNonNull(event);
//
// final PageState state = event.getPageState();
//
// final ExternalVideoAsset externalVideoAsset = new ExternalVideoAsset();
//
// updateData((Bookmark) externalVideoAsset, state);
// updateData(externalVideoAsset, state);
//
// return externalVideoAsset;
// }
protected void updateData(final ExternalVideoAsset externalVideoAsset,
final PageState state) {

View File

@ -27,17 +27,22 @@ import org.librecms.assets.FileAsset;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class FileAssetForm extends BinaryAssetForm {
public class FileAssetForm extends AbstractBinaryAssetForm<FileAsset> {
public FileAssetForm(final AssetPane assetPane) {
super(assetPane);
}
@Override
protected BinaryAsset createBinaryAsset(final PageState state) {
return new FileAsset();
protected Class<FileAsset> getAssetClass() {
return FileAsset.class;
}
// @Override
// protected BinaryAsset createBinaryAsset(final PageState state) {
// return new FileAsset();
// }
}

View File

@ -40,8 +40,9 @@ import java.util.Optional;
/**
*
* @author <a href="mailto:yannick.buelter@yabue.de">Yannick Bülter</a>
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class ImageForm extends BinaryAssetForm {
public class ImageForm extends AbstractBinaryAssetForm<Image> {
private TextField width;
private TextField height;
@ -82,13 +83,13 @@ public class ImageForm extends BinaryAssetForm {
@Override
protected void initForm(final PageState state,
final Optional<Asset> selectedAsset) {
final Optional<Image> selectedAsset) {
super.initForm(state, selectedAsset);
if (selectedAsset.isPresent()) {
Image image = (Image) selectedAsset.get();
final Image image = selectedAsset.get();
width.setValue(state,
Long.toString(image.getWidth()));
@ -105,20 +106,33 @@ public class ImageForm extends BinaryAssetForm {
}
@Override
protected Asset createAsset(final FormSectionEvent event)
throws FormProcessException {
final Image image = (Image) super.createAsset(event);
final PageState state = event.getPageState();
image.setHeight(Long.parseLong((String) height.getValue(state)));
image.setWidth(Long.parseLong((String) width.getValue(state)));
updateData(image, state);
return image;
protected Class<Image> getAssetClass() {
return Image.class;
}
// @Override
// protected Asset createAsset(final FormSectionEvent event)
// throws FormProcessException {
//
// final Image image = (Image) super.createAsset(event);
//
// final PageState state = event.getPageState();
//
// image.setDisplayName(getTitleValue(state)
// .toLowerCase()
// .replace(" ", "-"));
//
// if (height.getValue(state) != null) {
// image.setHeight(Long.parseLong((String) height.getValue(state)));
// }
// if (width.getValue(state) != null) {
// image.setWidth(Long.parseLong((String) width.getValue(state)));
// }
// updateData(image, state);
//
// return image;
// }
@Override
protected void updateAsset(final Asset asset,
final FormSectionEvent event)
@ -154,9 +168,9 @@ public class ImageForm extends BinaryAssetForm {
}
}
@Override
protected BinaryAsset createBinaryAsset(final PageState state) {
return new Image();
}
// @Override
// protected BinaryAsset createBinaryAsset(final PageState state) {
// return new Image();
// }
}

View File

@ -24,7 +24,7 @@ import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.cms.ui.assets.AssetForm;
import com.arsdigita.cms.ui.assets.AbstractAssetForm;
import com.arsdigita.cms.ui.assets.AssetPane;
import com.arsdigita.globalization.GlobalizedMessage;
@ -39,7 +39,7 @@ import java.util.Optional;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class LegalMetadataForm extends AssetForm {
public class LegalMetadataForm extends AbstractAssetForm<LegalMetadata> {
private TextArea rightsHolder;
private TextArea rights;
@ -84,7 +84,7 @@ public class LegalMetadataForm extends AssetForm {
@Override
protected void initForm(final PageState state,
final Optional<Asset> selectedAsset) {
final Optional<LegalMetadata> selectedAsset) {
if (selectedAsset.isPresent()) {
@ -96,8 +96,7 @@ public class LegalMetadataForm extends AssetForm {
selectedAsset.get().getClass().getName()));
}
final LegalMetadata legalMetadata = (LegalMetadata) selectedAsset
.get();
final LegalMetadata legalMetadata = selectedAsset.get();
rightsHolder.setValue(state, legalMetadata.getRightsHolder());
rights.setValue(state,
@ -112,7 +111,7 @@ public class LegalMetadataForm extends AssetForm {
@Override
protected void showLocale(final PageState state) {
final Optional<Asset> selectedAsset = getSelectedAsset(state);
final Optional<LegalMetadata> selectedAsset = getSelectedAsset(state);
if (selectedAsset.isPresent()) {
if (!(getSelectedAsset(state).get() instanceof LegalMetadata)) {
@ -120,8 +119,7 @@ public class LegalMetadataForm extends AssetForm {
"Selected asset is not a legal metadata");
}
final LegalMetadata legalMetadata = (LegalMetadata) selectedAsset.
get();
final LegalMetadata legalMetadata = selectedAsset.get();
rights.setValue(state,
legalMetadata
@ -131,25 +129,29 @@ public class LegalMetadataForm extends AssetForm {
}
@Override
protected Asset createAsset(final FormSectionEvent event)
throws FormProcessException {
Objects.requireNonNull(event);
final PageState state = event.getPageState();
final LegalMetadata legalMetadata = new LegalMetadata();
legalMetadata.setRightsHolder((String) rightsHolder.getValue(state));
legalMetadata.getRights().addValue(getSelectedLocale(state),
(String) rights.getValue(state));
legalMetadata.setPublisher((String) publisher.getValue(state));
legalMetadata.setCreator((String) creator.getValue(state));
return legalMetadata;
protected Class<LegalMetadata> getAssetClass() {
return LegalMetadata.class;
}
// @Override
// protected Asset createAsset(final FormSectionEvent event)
// throws FormProcessException {
//
// Objects.requireNonNull(event);
//
// final PageState state = event.getPageState();
//
// final LegalMetadata legalMetadata = new LegalMetadata();
//
// legalMetadata.setRightsHolder((String) rightsHolder.getValue(state));
// legalMetadata.getRights().addValue(getSelectedLocale(state),
// (String) rights.getValue(state));
//
// legalMetadata.setPublisher((String) publisher.getValue(state));
// legalMetadata.setCreator((String) creator.getValue(state));
//
// return legalMetadata;
// }
@Override
protected void updateAsset(final Asset asset,
final FormSectionEvent event)

View File

@ -23,11 +23,13 @@ import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.cms.ui.assets.AssetForm;
import com.arsdigita.cms.ui.assets.AbstractAssetForm;
import com.arsdigita.cms.ui.assets.AssetPane;
import com.arsdigita.globalization.GlobalizedMessage;
import java.util.Objects;
import java.util.Optional;
import org.librecms.CmsConstants;
import org.librecms.assets.SideNote;
import org.librecms.contentsection.Asset;
@ -36,7 +38,7 @@ import org.librecms.contentsection.Asset;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
public class SideNoteForm extends AssetForm {
public class SideNoteForm extends AbstractAssetForm<SideNote> {
private TextArea text;
@ -55,7 +57,7 @@ public class SideNoteForm extends AssetForm {
@Override
protected void initForm(final PageState state,
final Optional<Asset> selectedAsset) {
final Optional<SideNote> selectedAsset) {
if (selectedAsset.isPresent()) {
if (!(selectedAsset.get() instanceof SideNote)) {
@ -66,7 +68,7 @@ public class SideNoteForm extends AssetForm {
selectedAsset.get().getClass().getName()));
}
final SideNote sideNote = (SideNote) selectedAsset.get();
final SideNote sideNote = selectedAsset.get();
text.setValue(state,
sideNote
@ -79,7 +81,7 @@ public class SideNoteForm extends AssetForm {
@Override
protected void showLocale(final PageState state) {
final Optional<Asset> selectedAsset = getSelectedAsset(state);
final Optional<SideNote> selectedAsset = getSelectedAsset(state);
if (selectedAsset.isPresent()) {
if (!(selectedAsset.get() instanceof SideNote)) {
@ -90,7 +92,7 @@ public class SideNoteForm extends AssetForm {
selectedAsset.get().getClass().getName()));
}
final SideNote sideNote = (SideNote) selectedAsset.get();
final SideNote sideNote =selectedAsset.get();
text.setValue(state,
sideNote
@ -100,23 +102,30 @@ public class SideNoteForm extends AssetForm {
}
@Override
protected Asset createAsset(final FormSectionEvent event) throws
FormProcessException {
Objects.requireNonNull(event);
final PageState state = event.getPageState();
final SideNote sideNote = new SideNote();
sideNote
.getText()
.addValue(getSelectedLocale(state),
(String) text.getValue(state));
return sideNote;
protected Class<SideNote> getAssetClass() {
return SideNote.class;
}
// @Override
// protected Asset createAsset(final FormSectionEvent event) throws
// FormProcessException {
//
// Objects.requireNonNull(event);
//
// final PageState state = event.getPageState();
//
// final SideNote sideNote = new SideNote();
//
// sideNote
// .getText()
// .addValue(getSelectedLocale(state),
// (String) text.getValue(state));
//
// return sideNote;
// }
@Override
protected void updateAsset(final Asset asset,
final FormSectionEvent event)

View File

@ -26,9 +26,9 @@ import com.arsdigita.bebop.form.TextField;
import com.arsdigita.cms.ui.assets.AssetPane;
import com.arsdigita.cms.ui.assets.AssetSearchWidget;
import com.arsdigita.globalization.GlobalizedMessage;
import org.libreccm.cdi.utils.CdiUtil;
import org.librecms.CmsConstants;
import org.librecms.assets.BinaryAsset;
import org.librecms.assets.VideoAsset;
import org.librecms.assets.LegalMetadata;
import org.librecms.contentsection.Asset;
@ -39,8 +39,10 @@ import java.util.Optional;
/**
*
* @author <a href="mailto:yannick.buelter@yabue.de">Yannick Bülter</a>
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*
*/
public class VideoForm extends BinaryAssetForm {
public class VideoForm extends AbstractBinaryAssetForm<VideoAsset> {
private TextField width;
private TextField height;
@ -77,13 +79,14 @@ public class VideoForm extends BinaryAssetForm {
}
@Override
protected void initForm(PageState state, Optional<Asset> selectedAsset) {
protected void initForm(final PageState state,
final Optional<VideoAsset> selectedAsset) {
super.initForm(state, selectedAsset);
if (selectedAsset.isPresent()) {
VideoAsset video = (VideoAsset) selectedAsset.get();
final VideoAsset video = selectedAsset.get();
width.setValue(state,
Long.toString(video.getWidth()));
@ -98,20 +101,27 @@ public class VideoForm extends BinaryAssetForm {
}
@Override
protected Asset createAsset(final FormSectionEvent event)
throws FormProcessException {
final VideoAsset video = (VideoAsset) super.createAsset(event);
final PageState state = event.getPageState();
video.setHeight(Long.parseLong((String) height.getValue(state)));
video.setWidth(Long.parseLong((String) width.getValue(state)));
updateData(video, state);
return video;
protected Class<VideoAsset> getAssetClass() {
return VideoAsset.class;
}
// @Override
// protected Asset createAsset(final FormSectionEvent event)
// throws FormProcessException {
//
// final VideoAsset video = (VideoAsset) super.createAsset(event);
//
// final PageState state = event.getPageState();
//
// video.setHeight(Long.parseLong((String) height.getValue(state)));
// video.setWidth(Long.parseLong((String) width.getValue(state)));
// updateData(video, state);
//
// return video;
// }
@Override
protected void updateAsset(final Asset asset,
final FormSectionEvent event)
@ -147,8 +157,8 @@ public class VideoForm extends BinaryAssetForm {
}
}
@Override
protected BinaryAsset createBinaryAsset(final PageState state) {
return new VideoAsset();
}
// @Override
// protected BinaryAsset createBinaryAsset(final PageState state) {
// return new VideoAsset();
// }
}

View File

@ -18,7 +18,7 @@
*/
package org.librecms.assets;
import com.arsdigita.cms.ui.assets.AssetForm;
import com.arsdigita.cms.ui.assets.AbstractAssetForm;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
@ -50,7 +50,7 @@ public @interface AssetType {
* @return The form for editing and creating assets of the annotated sub
* class {@link org.librecms.contentsection.Asset}.
*/
Class<? extends AssetForm> assetForm();
Class<? extends AbstractAssetForm> assetForm();
/**
* The key for the localised label of the asset type. If not set the default

View File

@ -18,7 +18,7 @@
*/
package org.librecms.assets;
import com.arsdigita.cms.ui.assets.AssetForm;
import com.arsdigita.cms.ui.assets.AbstractAssetForm;
import org.librecms.contentsection.Asset;
@ -59,7 +59,7 @@ public class AssetTypeInfo {
/**
* The form for editing and creating asset of the type described.
*/
private Class<? extends AssetForm> assetForm;
private Class<? extends AbstractAssetForm> assetForm;
public String getLabelBundle() {
return labelBundle;
@ -101,11 +101,11 @@ public class AssetTypeInfo {
this.assetClass = assetClass;
}
public Class<? extends AssetForm> getAssetForm() {
public Class<? extends AbstractAssetForm> getAssetForm() {
return assetForm;
}
public void setAssetForm(final Class<? extends AssetForm> assetForm) {
public void setAssetForm(final Class<? extends AbstractAssetForm> assetForm) {
this.assetForm = assetForm;
}

View File

@ -259,6 +259,25 @@ import static org.librecms.CmsConstants.*;
+ " OR true = :isSystemUser OR true = :isAdmin"
+ ")")
,
@NamedQuery(
name = "Asset.findByNameInFolder",
query = "SELECT DISTINCT a "
+ "FROM Asset a "
+ "JOIN a.categories c "
+ "LEFT JOIN a.permissions p "
+ "WHERE c.category = :folder "
+ "AND c.type = '" + CATEGORIZATION_TYPE_FOLDER + "' "
+ "AND a.displayName = :name "
+ "AND ("
+ " ("
+ " p.grantee IN :roles "
+ " AND p.grantedPrivilege = '"
+ AssetPrivileges.VIEW + "'"
+ " ) "
+ " OR true = :isSystemUser OR true = :isAdmin"
+ " )"
)
,
@NamedQuery(
name = "Asset.countInFolder",
query = "SELECT COUNT(DISTINCT a) "

View File

@ -45,6 +45,7 @@ import java.util.Objects;
import org.libreccm.categorization.ObjectNotAssignedToCategoryException;
import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.security.PermissionManager;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
@ -52,6 +53,7 @@ import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
@ -69,9 +71,6 @@ public class AssetManager {
private static final Logger LOGGER = LogManager.
getLogger(AssetManager.class);
@Inject
private EntityManager entityManager;
@Inject
private AssetRepository assetRepo;
@ -82,7 +81,47 @@ public class AssetManager {
private FolderRepository folderRepo;
@Inject
private FolderManager folderManager;
private PermissionManager permissionManager;
@Transactional(Transactional.TxType.REQUIRED)
public <T extends Asset> T createAsset(final String name,
final String title,
final Locale locale,
final Folder folder,
final Class<T> assetType) {
Objects.requireNonNull(name);
Objects.requireNonNull(title);
Objects.requireNonNull(locale);
Objects.requireNonNull(folder);
Objects.requireNonNull(assetType);
if (name.trim().isEmpty()) {
throw new IllegalArgumentException(
"The name of an asset can't be empty.");
}
if (title.trim().isEmpty()) {
throw new IllegalArgumentException(
"The title of an asset can't be empty.");
}
final T asset;
try {
asset = assetType.newInstance();
} catch (IllegalAccessException | InstantiationException ex) {
throw new UnexpectedErrorException(ex);
}
asset.setDisplayName(name);
asset.getTitle().addValue(locale, title);
assetRepo.save(asset);
categoryManager.addObjectToCategory(asset, folder);
permissionManager.copyPermissions(folder, asset, true);
return asset;
}
/**
* Makes an {@link Asset} a shared {@code Asset} by adding it to an asset

View File

@ -18,10 +18,14 @@
*/
package org.librecms.contentsection;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.libreccm.auditing.AbstractAuditedEntityRepository;
import org.libreccm.categorization.Categorization;
import org.libreccm.categorization.Category;
import org.libreccm.categorization.CategoryManager;
import org.libreccm.categorization.ObjectNotAssignedToCategoryException;
import org.libreccm.core.CcmObject;
import org.libreccm.core.CcmObjectRepository;
import org.libreccm.core.UnexpectedErrorException;
import org.libreccm.security.AuthorizationRequired;
@ -54,6 +58,9 @@ import javax.transaction.Transactional;
public class AssetRepository
extends AbstractAuditedEntityRepository<Long, Asset> {
private static final Logger LOGGER = LogManager
.getLogger(AssetRepository.class);
@Inject
private Shiro shiro;
@ -69,6 +76,9 @@ public class AssetRepository
@Inject
private CategoryManager categoryManager;
@Inject
private FolderRepository folderRepo;
@Inject
private AssetManager assetManager;
@ -523,6 +533,86 @@ public class AssetRepository
return query.getResultList();
}
@Transactional(Transactional.TxType.REQUIRED)
public Optional<Asset> findByNameInFolder(final Folder folder,
final String name) {
final TypedQuery<Asset> query = getEntityManager()
.createNamedQuery("Asset.findByNameInFolder",
Asset.class)
.setParameter("folder", folder)
.setParameter("name", name);
// setAuthorizationParameters(query);
try {
return Optional.of(query.getSingleResult());
} catch (NoResultException ex) {
return Optional.empty();
}
}
@Transactional(Transactional.TxType.REQUIRED)
public Optional<Asset> findByPath(final String path) {
//The last token is the name of the asset itself. Remove this part and
//get the folder containing the asset using the FolderRepository.
final String normalizedPath = PathUtil.normalizePath(path);
final int lastTokenStart = normalizedPath.lastIndexOf('/');
final String folderPath = normalizedPath.substring(0, lastTokenStart);
final String assetName = normalizedPath.substring(lastTokenStart + 1);
final Optional<Folder> folder = folderRepo.findByPath(
folderPath, FolderType.ASSETS_FOLDER);
if (folder.isPresent()) {
return findByNameInFolder(folder.get(), assetName);
} else {
return Optional.empty();
}
}
@Transactional(Transactional.TxType.REQUIRED)
public Optional<Asset> findByPath(final ContentSection section,
final String path) {
//The last token is the name of the asset itself. Remove this part an get
//the folder containing the asset using the FolderRepository.
final String normalizedPath = PathUtil.normalizePath(path);
final int lastTokenStart = normalizedPath.lastIndexOf('/');
final String assetName;
final Optional<Folder> folder;
if (lastTokenStart < 0) {
assetName = normalizedPath;
folder = folderRepo
.findById(section.getRootAssetsFolder().getObjectId());
} else {
final String folderPath = normalizedPath
.substring(0, lastTokenStart);
assetName = normalizedPath.substring(lastTokenStart + 1);
folder = folderRepo
.findByPath(section, folderPath, FolderType.ASSETS_FOLDER);
}
if (folder.isPresent()) {
LOGGER.debug("transaction is active? {}",
entityManager.isJoinedToTransaction());
LOGGER.debug("Folder for path {} found...", path);
// LOGGER.debug("Assets in the folder:");
// final Folder theFolder = folderRepo
// .findById(folder.get().getObjectId())
// .orElseThrow(() -> new IllegalArgumentException());
for (final Categorization categorization : folder.get().getObjects()) {
LOGGER.debug(" {}",
categorization.getCategorizedObject()
.getDisplayName());
}
return findByNameInFolder(folder.get(), assetName);
} else {
return Optional.empty();
}
}
/**
* Counts the assets of a specific type which name starts with a provided
* string in a specific folder.

View File

@ -18,8 +18,6 @@
*/
package org.librecms.contentsection;
import com.arsdigita.kernel.KernelConfig;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -70,6 +68,7 @@ import javax.persistence.TypedQuery;
import javax.transaction.Transactional;
import org.libreccm.security.PermissionChecker;
import org.libreccm.security.PermissionManager;
import org.librecms.contentsection.privileges.TypePrivileges;
/**
@ -84,41 +83,41 @@ public class ContentItemManager {
ContentItemManager.class);
@Inject
private EntityManager entityManager;
@Inject
private ConfigurationManager confManager;
private AssetManager assetManager;
@Inject
private CategoryManager categoryManager;
@Inject
private FolderManager folderManager;
private ContentItemRepository contentItemRepo;
@Inject
private ContentSectionManager sectionManager;
@Inject
private ContentItemRepository contentItemRepo;
@Inject
private ContentTypeRepository typeRepo;
@Inject
private LifecycleManager lifecycleManager;
private EntityManager entityManager;
@Inject
private WorkflowManager workflowManager;
private FolderManager folderManager;
@Inject
private FolderRepository folderRepo;
@Inject
private AssetManager assetManager;
private LifecycleManager lifecycleManager;
@Inject
private PermissionChecker permissionChecker;
@Inject
private PermissionManager permissionManager;
@Inject
private WorkflowManager workflowManager;
/**
* Creates a new content item in the provided content section and folder
* with the default workflow for the content type of the item.
@ -319,9 +318,6 @@ public class ContentItemManager {
throw new RuntimeException(ex);
}
final KernelConfig kernelConfig = confManager.findConfiguration(
KernelConfig.class);
item.setDisplayName(name);
item.getName().addValue(locale,
name);
@ -352,6 +348,8 @@ public class ContentItemManager {
workflowManager.start(item.getWorkflow());
}
permissionManager.copyPermissions(folder, item, true);
return item;
}

View File

@ -410,7 +410,7 @@ public class ContentItemRepository
@Transactional(Transactional.TxType.REQUIRED)
public Optional<ContentItem> findByPath(final String path) {
//The last token is the name of the item itself. Remove this part an get
//The last token is the name of the item itself. Remove this part and get
//the folder containing the item using the FolderRepository.
final String normalizedPath = PathUtil.normalizePath(path);
final int lastTokenStart = normalizedPath.lastIndexOf('/');

View File

@ -34,16 +34,15 @@ public final class PathUtil {
*
* The method does the following:
* <ul>
* <li>Replace all "<code>.</code>" in the path with a slash.</li>
* <li>If the first character is a slash remove the character.</li>
* <li>If the last character is a slash remove the character.</li>
* </ul>
*
* @param path
* @return
* @param path The path to normalise.
* @return The normalised path
*/
protected static final String normalizePath(final String path) {
String normalizedPath = path.replace('.', '/');
String normalizedPath = path;
if (normalizedPath.charAt(0) == '/') {
normalizedPath = normalizedPath.substring(1);
}

View File

@ -37,6 +37,7 @@ public class ContentSections extends Application{
final Set<Class<?>> classes = new HashSet<>();
classes.add(Assets.class);
classes.add(Images.class);
return classes;
}

View File

@ -0,0 +1,110 @@
/*
* Copyright (C) 2017 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.librecms.contentsection.rs;
import org.librecms.assets.Image;
import org.librecms.contentsection.Asset;
import org.librecms.contentsection.AssetRepository;
import org.librecms.contentsection.ContentSection;
import org.librecms.contentsection.ContentSectionRepository;
import java.util.Optional;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@Path("/{content-section}/images/")
public class Images {
@Inject
private ContentSectionRepository sectionRepo;
@Inject
private AssetRepository assetRepo;
@GET
@Path("/{path:.+}")
public Response getImage(
@PathParam("content-section") final String sectionName,
@PathParam("path") final String path) {
final Optional<ContentSection> section = sectionRepo
.findByLabel(sectionName);
if (!section.isPresent()) {
return Response
.status(Response.Status.NOT_FOUND)
.entity(String.format("No content section \"%s\" available.",
sectionName))
.build();
}
final Optional<Asset> asset = assetRepo.findByPath(section.get(),
path);
if (asset.isPresent()) {
if (asset.get() instanceof Image) {
final Image image = (Image) asset.get();
final byte[] data = image.getData();
return Response
.ok(String.format(
"Requested image \"%s\" in content section \"%s\"",
path,
section.get().getLabel()),
"text/plain")
.build();
} else {
return Response
.status(Response.Status.NOT_FOUND)
.entity(String
.format("The asset found at the requested path \"%s\" "
+ "is not an image.",
path))
.build();
}
} else {
return Response
.status(Response.Status.NOT_FOUND)
.entity(String
.format("The requested image \"%s\" does not exist.",
path))
.build();
}
// final Response.ResponseBuilder builder = Response
// .ok(String.format(
// "Requested image \"%s\" from folder \"%s\" in content section \"%s\"",
// imageName,
// folderPath,
// section.get().getLabel()),
// "text/plain");
//
// return builder.build();
}
}

View File

@ -221,11 +221,14 @@ public class ContentItemManagerTest {
value = "datasets/org/librecms/contentsection/"
+ "ContentItemManagerTest/after-create-contentitem.xml",
excludeColumns = {"categorization_id",
"creation_date",
"id",
"inherited_from_id",
"item_uuid",
"lifecycle_id",
"object_id",
"object_order",
"permission_id",
"phase_id",
"rev",
"task_assignment_id",
@ -391,11 +394,14 @@ public class ContentItemManagerTest {
+ "ContentItemManagerTest/"
+ "after-create-contentitem-with-workflow.xml",
excludeColumns = {"categorization_id",
"creation_date",
"id",
"inherited_from_id",
"item_uuid",
"lifecycle_id",
"object_id",
"object_order",
"permission_id",
"phase_id",
"rev",
"task_id",

View File

@ -749,341 +749,614 @@
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4120"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4130"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4140"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4150"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4210"
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4220"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4230"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4240"
granted_privilege="approve_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4250"
granted_privilege="delete_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4260"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4270"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4310"
granted_privilege="administer_roles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4320"
granted_privilege="administer_workflow"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4330"
granted_privilege="administer_lifecyles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4340"
granted_privilege="administer_categories"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4350"
granted_privilege="administer_content_types"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4360"
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4370"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4380"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4390"
granted_privilege="approve_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4400"
granted_privilege="publish_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4410"
granted_privilege="delete_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4420"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4430"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4510"
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4520"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4530"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4540"
granted_privilege="approve_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4550"
granted_privilege="publish_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4560"
granted_privilege="delete_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4570"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4580"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4610"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3600"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4710"
granted_privilege="categorize_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4720"
granted_privilege="create_new_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4730"
granted_privilege="edit_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4740"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4750"
granted_privilege="preview_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4810"
granted_privilege="categorize_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4820"
granted_privilege="create_new_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4830"
granted_privilege="edit_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4840"
granted_privilege="approve_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4850"
granted_privilege="delete_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4860"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4870"
granted_privilege="preview_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4910"
granted_privilege="administer_roles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4920"
granted_privilege="administer_workflow"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4930"
granted_privilege="administer_lifecyles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4940"
granted_privilege="administer_categories"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4950"
granted_privilege="administer_content_types"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4960"
granted_privilege="categorize_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4970"
granted_privilege="create_new_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4980"
granted_privilege="edit_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4990"
granted_privilege="approve_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5000"
granted_privilege="publish_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5010"
granted_privilege="delete_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5020"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5030"
granted_privilege="preview_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5110"
granted_privilege="categorize_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5120"
granted_privilege="create_new_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5130"
granted_privilege="edit_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5140"
granted_privilege="approve_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5150"
granted_privilege="publish_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5160"
granted_privilege="delete_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5170"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5180"
granted_privilege="preview_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5210"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3600"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-411010"
granted_privilege="categorize_items"
object_id="-12100"
grantee_id="-3200"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-412020"
granted_privilege="create_new_items"
object_id="-12100"
grantee_id="-3200"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-413030"
granted_privilege="edit_items"
object_id="-12100"
grantee_id="-3200"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-414040"
granted_privilege="view_published_items"
object_id="-12100"
grantee_id="-3200"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-415050"
granted_privilege="preview_items"
object_id="-12100"
grantee_id="-3200"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-421010"
granted_privilege="categorize_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-422020"
granted_privilege="create_new_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-423030"
granted_privilege="edit_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-424040"
granted_privilege="approve_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-425050"
granted_privilege="delete_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-426060"
granted_privilege="view_published_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-427070"
granted_privilege="preview_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-436060"
granted_privilege="categorize_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-437070"
granted_privilege="create_new_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-438080"
granted_privilege="edit_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-439090"
granted_privilege="approve_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-440000"
granted_privilege="publish_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-441010"
granted_privilege="delete_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-442020"
granted_privilege="view_published_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-443030"
granted_privilege="preview_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-451010"
granted_privilege="categorize_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-452020"
granted_privilege="create_new_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-453030"
granted_privilege="edit_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-454040"
granted_privilege="approve_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-455050"
granted_privilege="publish_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-456060"
granted_privilege="delete_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-457070"
granted_privilege="view_published_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-458080"
granted_privilege="preview_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-461010"
granted_privilege="view_published_items"
object_id="-12100"
grantee_id="-3600"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
</dataset>

View File

@ -765,341 +765,612 @@
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4120"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4130"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4140"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4150"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4210"
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4220"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4230"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4240"
granted_privilege="approve_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4250"
granted_privilege="delete_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4260"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4270"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4310"
granted_privilege="administer_roles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4320"
granted_privilege="administer_workflow"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4330"
granted_privilege="administer_lifecyles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4340"
granted_privilege="administer_categories"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4350"
granted_privilege="administer_content_types"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4360"
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4370"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4380"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4390"
granted_privilege="approve_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4400"
granted_privilege="publish_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4410"
granted_privilege="delete_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4420"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4430"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4510"
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4520"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4530"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4540"
granted_privilege="approve_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4550"
granted_privilege="publish_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4560"
granted_privilege="delete_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4570"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4580"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4610"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3600"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4710"
granted_privilege="categorize_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4720"
granted_privilege="create_new_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4730"
granted_privilege="edit_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4740"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4750"
granted_privilege="preview_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4810"
granted_privilege="categorize_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4820"
granted_privilege="create_new_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4830"
granted_privilege="edit_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4840"
granted_privilege="approve_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4850"
granted_privilege="delete_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4860"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4870"
granted_privilege="preview_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4910"
granted_privilege="administer_roles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4920"
granted_privilege="administer_workflow"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4930"
granted_privilege="administer_lifecyles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4940"
granted_privilege="administer_categories"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4950"
granted_privilege="administer_content_types"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4960"
granted_privilege="categorize_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4970"
granted_privilege="create_new_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4980"
granted_privilege="edit_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4990"
granted_privilege="approve_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5000"
granted_privilege="publish_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5010"
granted_privilege="delete_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5020"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5030"
granted_privilege="preview_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5110"
granted_privilege="categorize_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5120"
granted_privilege="create_new_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5130"
granted_privilege="edit_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5140"
granted_privilege="approve_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5150"
granted_privilege="publish_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5160"
granted_privilege="delete_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5170"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5180"
granted_privilege="preview_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5210"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3600"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-411010"
granted_privilege="categorize_items"
object_id="-12100"
grantee_id="-3200"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-412020"
granted_privilege="create_new_items"
object_id="-12100"
grantee_id="-3200"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-413030"
granted_privilege="edit_items"
object_id="-12100"
grantee_id="-3200"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-414040"
granted_privilege="view_published_items"
object_id="-12100"
grantee_id="-3200"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-415050"
granted_privilege="preview_items"
object_id="-12100"
grantee_id="-3200"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-421010"
granted_privilege="categorize_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-422020"
granted_privilege="create_new_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-423030"
granted_privilege="edit_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-424040"
granted_privilege="approve_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-425050"
granted_privilege="delete_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-426060"
granted_privilege="view_published_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-427070"
granted_privilege="preview_items"
object_id="-12100"
grantee_id="-3300"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-436060"
granted_privilege="categorize_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-437070"
granted_privilege="create_new_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-438080"
granted_privilege="edit_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-439090"
granted_privilege="approve_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-440000"
granted_privilege="publish_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-441010"
granted_privilege="delete_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-442020"
granted_privilege="view_published_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-443030"
granted_privilege="preview_items"
object_id="-12100"
grantee_id="-3400"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-451010"
granted_privilege="categorize_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-452020"
granted_privilege="create_new_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-453030"
granted_privilege="edit_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-454040"
granted_privilege="approve_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-455050"
granted_privilege="publish_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-456060"
granted_privilege="delete_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-457070"
granted_privilege="view_published_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-458080"
granted_privilege="preview_items"
object_id="-12100"
grantee_id="-3500"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
<ccm_core.permissions permission_id="-461010"
granted_privilege="view_published_items"
object_id="-12100"
grantee_id="-3600"
creation_date="2016-07-15"
inherited="true"
inherited_from_id="-2100" />
</dataset>

View File

@ -686,341 +686,409 @@
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4120"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4130"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4140"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4150"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4210"
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4220"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4230"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4240"
granted_privilege="approve_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4250"
granted_privilege="delete_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4260"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4270"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4310"
granted_privilege="administer_roles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4320"
granted_privilege="administer_workflow"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4330"
granted_privilege="administer_lifecyles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4340"
granted_privilege="administer_categories"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4350"
granted_privilege="administer_content_types"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4360"
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4370"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4380"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4390"
granted_privilege="approve_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4400"
granted_privilege="publish_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4410"
granted_privilege="delete_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4420"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4430"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4510"
granted_privilege="categorize_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4520"
granted_privilege="create_new_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4530"
granted_privilege="edit_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4540"
granted_privilege="approve_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4550"
granted_privilege="publish_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4560"
granted_privilege="delete_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4570"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4580"
granted_privilege="preview_items"
object_id="-2100"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4610"
granted_privilege="view_published_items"
object_id="-2100"
grantee_id="-3600"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4710"
granted_privilege="categorize_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4720"
granted_privilege="create_new_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4730"
granted_privilege="edit_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4740"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4750"
granted_privilege="preview_items"
object_id="-2300"
grantee_id="-3200"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4810"
granted_privilege="categorize_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4820"
granted_privilege="create_new_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4830"
granted_privilege="edit_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4840"
granted_privilege="approve_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4850"
granted_privilege="delete_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4860"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4870"
granted_privilege="preview_items"
object_id="-2300"
grantee_id="-3300"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4910"
granted_privilege="administer_roles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4920"
granted_privilege="administer_workflow"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4930"
granted_privilege="administer_lifecyles"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4940"
granted_privilege="administer_categories"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4950"
granted_privilege="administer_content_types"
object_id="-1100"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4960"
granted_privilege="categorize_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4970"
granted_privilege="create_new_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4980"
granted_privilege="edit_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-4990"
granted_privilege="approve_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5000"
granted_privilege="publish_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5010"
granted_privilege="delete_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5020"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5030"
granted_privilege="preview_items"
object_id="-2300"
grantee_id="-3400"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5110"
granted_privilege="categorize_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5120"
granted_privilege="create_new_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5130"
granted_privilege="edit_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5140"
granted_privilege="approve_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5150"
granted_privilege="publish_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5160"
granted_privilege="delete_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5170"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5180"
granted_privilege="preview_items"
object_id="-2300"
grantee_id="-3500"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
<ccm_core.permissions permission_id="-5210"
granted_privilege="view_published_items"
object_id="-2300"
grantee_id="-3600"
creation_date="2016-07-15"/>
creation_date="2016-07-15"
inherited="false" />
</dataset>

View File

@ -129,12 +129,16 @@ public class PermissionManager {
* @param grantee The role to which the privilege is granted.
* @param object The object on which the privilege is granted.
*
* @return The newly granted permission. If there is also none inherited
* permission granting the provided {@code privilege} on the
* provided {@code object} the return value is {@code null}.
*
* @see RecursivePermissions
*/
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public void grantPrivilege(final String privilege,
public Permission grantPrivilege(final String privilege,
final Role grantee,
final CcmObject object) {
if (privilege == null || privilege.isEmpty()) {
@ -156,7 +160,9 @@ public class PermissionManager {
revokePrivilege(privilege, grantee, object);
}
if (!existsPermission(privilege, grantee, object)) {
if (existsPermission(privilege, grantee, object)) {
return null;
} else {
final Permission permission = new Permission();
permission.setGrantee(grantee);
permission.setGrantedPrivilege(privilege);
@ -166,6 +172,8 @@ public class PermissionManager {
entityManager.persist(permission);
grantRecursive(privilege, grantee, object, object.getClass(), object);
return permission;
}
}
@ -485,14 +493,35 @@ public class PermissionManager {
* permissions.
*
*
* @param source
* @param target
* @param source The source object from which the permissions are copied.
* @param target The target object to which the permissions are copied.
*/
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public void copyPermissions(final CcmObject source,
final CcmObject target) {
copyPermissions(source, target, false);
}
/**
* Copy the permissions from on {@link CcmObject} to another. The
* permissions granted on the {@code target} object will not be removed.
* Instead the permissions from {@code source} object are added the the
* permissions. This variant is should only be used to copy permissions from
* a parent object (like a category) to a new or newly assigned object.
*
* @param source The source object from which the permissions are copied.
* @param target The target object to which the permissions are copied.
* @param inherited Value for the {@link Permission#inherited} field of the
* copied permission.
*/
@AuthorizationRequired
@RequiresPrivilege(CoreConstants.PRIVILEGE_ADMIN)
@Transactional(Transactional.TxType.REQUIRED)
public void copyPermissions(final CcmObject source,
final CcmObject target,
final boolean inherited) {
if (source == null) {
throw new IllegalArgumentException(
"Can't copy permissions from source NULL.");
@ -509,9 +538,15 @@ public class PermissionManager {
final List<Permission> result = query.getResultList();
for (final Permission permission : result) {
grantPrivilege(permission.getGrantedPrivilege(),
final Permission granted = grantPrivilege(
permission.getGrantedPrivilege(),
permission.getGrantee(),
target);
granted.setInherited(inherited);
if (inherited) {
granted.setInheritedFrom(source);
}
entityManager.merge(granted);
}
}