001/* 002 * (C) Copyright 2006-2008 Nuxeo SAS (http://nuxeo.com/) and contributors. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the GNU Lesser General Public License 006 * (LGPL) version 2.1 which accompanies this distribution, and is available at 007 * http://www.gnu.org/licenses/lgpl.html 008 * 009 * This library is distributed in the hope that it will be useful, 010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 012 * Lesser General Public License for more details. 013 * 014 * Contributors: 015 * arussel 016 */ 017package org.nuxeo.ecm.platform.publisher.task; 018 019import org.nuxeo.ecm.core.api.CoreSession; 020import org.nuxeo.ecm.core.api.DocumentModel; 021import org.nuxeo.ecm.core.api.UnrestrictedSessionRunner; 022import org.nuxeo.ecm.core.api.security.ACP; 023 024/** 025 * @author arussel 026 * @author ataillefer XXX ataillefer: get rid of oldAclName if refactor old JBPM ACL name 027 */ 028public class RemoveACLUnrestricted extends UnrestrictedSessionRunner { 029 private final DocumentModel document; 030 031 private final String aclName; 032 033 private final String oldAclName; 034 035 public RemoveACLUnrestricted(CoreSession session, DocumentModel document, String aclName, String oldAclName) { 036 super(session); 037 this.document = document; 038 this.aclName = aclName; 039 this.oldAclName = oldAclName; 040 } 041 042 @Override 043 public void run() { 044 ACP acp = document.getACP(); 045 acp.removeACL(aclName); 046 acp.removeACL(oldAclName); 047 session.setACP(document.getRef(), acp, true); 048 session.save(); 049 acp = document.getACP(); 050 } 051 052}