Edit links werden jetzt auch in ObjectLists angezeigt (Vorbereitung für Ticket #1670).
git-svn-id: https://svn.libreccm.org/ccm/trunk@2112 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
f23c30d8f9
commit
d7f85f04bf
|
|
@ -152,11 +152,12 @@ public class SimpleXMLGenerator implements XMLGenerator {
|
||||||
//
|
//
|
||||||
// Note that the xml that is generated is only of use if you DO NOT CACHE content pages.
|
// Note that the xml that is generated is only of use if you DO NOT CACHE content pages.
|
||||||
// cg.
|
// cg.
|
||||||
|
|
||||||
final PermissionDescriptor edit = new PermissionDescriptor(
|
final PermissionDescriptor edit = new PermissionDescriptor(
|
||||||
PrivilegeDescriptor.get(SecurityManager.CMS_EDIT_ITEM), item, currentParty);
|
PrivilegeDescriptor.get(SecurityManager.CMS_EDIT_ITEM), item, currentParty);
|
||||||
if (PermissionService.checkPermission(edit)) {
|
if (PermissionService.checkPermission(edit)) {
|
||||||
parent.addAttribute("canEdit", "true");
|
parent.addAttribute("canEdit", "true");
|
||||||
|
final Element canEditElem = parent.newChildElement("canEdit");
|
||||||
|
canEditElem.setText("true");
|
||||||
}
|
}
|
||||||
final PermissionDescriptor publish = new PermissionDescriptor(
|
final PermissionDescriptor publish = new PermissionDescriptor(
|
||||||
PrivilegeDescriptor.get(SecurityManager.CMS_PUBLISH), item, currentParty);
|
PrivilegeDescriptor.get(SecurityManager.CMS_PUBLISH), item, currentParty);
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,11 @@ import com.arsdigita.categorization.Category;
|
||||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
import com.arsdigita.domain.DomainObjectFactory;
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
|
import com.arsdigita.kernel.Kernel;
|
||||||
|
import com.arsdigita.kernel.Party;
|
||||||
|
import com.arsdigita.kernel.permissions.PermissionDescriptor;
|
||||||
|
import com.arsdigita.kernel.permissions.PermissionService;
|
||||||
|
import com.arsdigita.kernel.permissions.PrivilegeDescriptor;
|
||||||
import com.arsdigita.persistence.DataAssociation;
|
import com.arsdigita.persistence.DataAssociation;
|
||||||
import com.arsdigita.persistence.DataAssociationCursor;
|
import com.arsdigita.persistence.DataAssociationCursor;
|
||||||
import com.arsdigita.persistence.DataCollection;
|
import com.arsdigita.persistence.DataCollection;
|
||||||
|
|
@ -232,7 +237,27 @@ public class DataCollectionRenderer extends LockableImpl {
|
||||||
}
|
}
|
||||||
final Element item = Navigation.newElement(content, "item");
|
final Element item = Navigation.newElement(content, "item");
|
||||||
|
|
||||||
final Iterator attributes = m_attributes.iterator();
|
// Create a canEdit link if the current user is permitted to edit the item.
|
||||||
|
// Note: Works only when list specializes the object because an ACSObject instance is needed for creating
|
||||||
|
// the PermissionDescriptor.
|
||||||
|
Party currentParty = Kernel.getContext().getParty();
|
||||||
|
if (currentParty == null) {
|
||||||
|
currentParty = Kernel.getPublicUser();
|
||||||
|
}
|
||||||
|
final PermissionDescriptor edit;
|
||||||
|
if (!m_specializeObjects || object == null) {
|
||||||
|
edit = new PermissionDescriptor(PrivilegeDescriptor.get(
|
||||||
|
com.arsdigita.cms.SecurityManager.CMS_EDIT_ITEM), dobj.getOID(), currentParty.getOID());
|
||||||
|
} else {
|
||||||
|
edit = new PermissionDescriptor(PrivilegeDescriptor.get(
|
||||||
|
com.arsdigita.cms.SecurityManager.CMS_EDIT_ITEM), object, currentParty);
|
||||||
|
}
|
||||||
|
if (PermissionService.checkPermission(edit)) {
|
||||||
|
item.addAttribute("canEdit", "true");
|
||||||
|
}
|
||||||
|
|
||||||
|
final Iterator attributes = m_attributes.
|
||||||
|
iterator();
|
||||||
while (attributes.hasNext()) {
|
while (attributes.hasNext()) {
|
||||||
final String name = (String) attributes.next();
|
final String name = (String) attributes.next();
|
||||||
final String[] paths = StringUtils.split(name, '.');
|
final String[] paths = StringUtils.split(name, '.');
|
||||||
|
|
@ -343,7 +368,6 @@ public class DataCollectionRenderer extends LockableImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void generateItemXML(final Element item, final DataObject dobj, final ACSObject obj, final int index) {
|
protected void generateItemXML(final Element item, final DataObject dobj, final ACSObject obj, final int index) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue