Merged V2.2 to HEAD

7575: Permission changes for AVM.
   7577: Incorporated most of the feedback provided by Kevin C earlier today
   7578: Removed directory not removed by patch
   7579: EmailServer bug fixes
         AR-1902:  Double posts when emailing to a document
         AR-1904:  Attachments via email should be allowed on forum posts
         AR-1903:  (Partial Fix) Text attachments should be treated the same way as other attachments 
   7583: Fixed WCM-961 & WCM-962: Added confirm dialog for 'Delete All Deployment Reports' and 'Release Server' actions


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8434 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-03-06 14:43:55 +00:00
parent a9fac10b45
commit a49bfd311d
89 changed files with 21301 additions and 11139 deletions

View File

@@ -0,0 +1,64 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing"
*/
package org.alfresco.repo.admin.patch.impl;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
/**
* The roles defined in permissionsDefinition.xml moved from <b>wca:webfolder</b> to <b>cm:cmobject</b>.
* This effects the data stored in the <b>permission</b> table.
* <p>
*
*/
public class AVMPermissionDataPatch extends AbstractPermissionChangePatch
{
private static final String MSG_SUCCESS = "patch.updateAvmPermissionData.result";
private static final QName TYPE_QNAME_OLD = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "webfolder");
private static final QName TYPE_QNAME_NEW = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "cmobject");
private static final String[] NAMES = new String[] {"ContentManager", "ContentPublisher", "ContentContributor", "ContentReviewer"};
@Override
protected String applyInternal() throws Exception
{
int updateCount = 0;
for (String permissionName : NAMES)
{
updateCount += super.renamePermission(
AVMPermissionDataPatch.TYPE_QNAME_OLD,
permissionName,
AVMPermissionDataPatch.TYPE_QNAME_NEW,
permissionName);
}
// build the result message
String msg = I18NUtil.getMessage(MSG_SUCCESS, updateCount);
// done
return msg;
}
}

View File

@@ -0,0 +1,60 @@
/*
* Copyright (C) 2005-2007 Alfresco Software Limited.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* As a special exception to the terms and conditions of version 2.0 of
* the GPL, you may redistribute this Program in connection with Free/Libre
* and Open Source Software ("FLOSS") applications as described in Alfresco's
* FLOSS exception. You should have recieved a copy of the text describing
* the FLOSS exception, and it is also available here:
* http://www.alfresco.com/legal/licensing
*/
package org.alfresco.repo.admin.patch.impl;
import java.util.Map;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.repo.admin.patch.AbstractPatch;
import org.alfresco.repo.domain.AccessControlListDAO;
import org.alfresco.repo.security.permissions.ACLType;
/**
* Migrate permissions from the OLD format to defining, shared and layered
*/
public class AVMPermissionsPatch extends AbstractPatch
{
private static final String MSG_SUCCESS = "patch.updateAvmPermissions.result";
private AccessControlListDAO accessControlListDao;
@Override
protected String applyInternal() throws Exception
{
Map<ACLType, Integer> summary = accessControlListDao.patchAcls();
// build the result message
String msg = I18NUtil.getMessage(MSG_SUCCESS, summary.get(ACLType.DEFINING), summary.get(ACLType.LAYERED));
// done
return msg;
}
public void setAccessControlListDao(AccessControlListDAO accessControlListDao)
{
this.accessControlListDao = accessControlListDao;
}
}

View File

@@ -96,7 +96,6 @@ public abstract class AbstractPermissionChangePatch extends AbstractPatch
private static class HibernateHelper extends HibernateDaoSupport
{
private static final String QUERY_GET_PERMISSION = "permission.GetPermission";
private static final String QUERY_GET_ENTRIES_TO_CHANGE = "permission.patch.GetAccessControlEntriesToChangePermissionOn";
public int createAndUpdatePermission(
final QName oldTypeQName,
@@ -109,7 +108,7 @@ public abstract class AbstractPermissionChangePatch extends AbstractPatch
throw new IllegalArgumentException("Cannot move permission to itself: " + oldTypeQName + "-" + oldName);
}
HibernateCallback getNewPermissionCallback = new GetPermissionCallback(newTypeQName, newName);
HibernateCallback getNewPermissionCallback = new GetPermissionCallback(oldTypeQName, oldName);
DbPermission permission = (DbPermission) getHibernateTemplate().execute(getNewPermissionCallback);
if (permission == null)
{
@@ -120,58 +119,13 @@ public abstract class AbstractPermissionChangePatch extends AbstractPatch
// save
getHibernateTemplate().save(permission);
}
final DbPermission newPermission = permission;
// now update all entries that refer to the old permission
HibernateCallback updateEntriesCallback = new HibernateCallback()
else
{
private static final int MAX_RESULTS = 1000;
@SuppressWarnings("unchecked")
public Object doInHibernate(Session session)
{
int count = 0;
while (true)
{
// flush any outstanding entities
session.flush();
Query query = session.getNamedQuery(HibernateHelper.QUERY_GET_ENTRIES_TO_CHANGE);
query.setParameter("oldTypeQName", oldTypeQName)
.setParameter("oldName", oldName)
.setMaxResults(MAX_RESULTS);
List<DbAccessControlEntry> entries = (List<DbAccessControlEntry>) query.list();
// if there are no results, then we're done
if (entries.size() == 0)
{
break;
}
for (DbAccessControlEntry entry : entries)
{
entry.setPermission(newPermission);
count++;
session.evict(entry);
}
// flush and evict all the entries
session.flush();
for (DbAccessControlEntry entry : entries)
{
session.evict(entry);
}
// next set of results
}
// done
return count;
}
};
int updateCount = (Integer) getHibernateTemplate().execute(updateEntriesCallback);
// now delete the old permission
HibernateCallback getOldPermissionCallback = new GetPermissionCallback(oldTypeQName, oldName);
DbPermission oldPermission = (DbPermission) getHibernateTemplate().execute(getOldPermissionCallback);
if (oldPermission != null)
{
getHibernateTemplate().delete(oldPermission);
permission.setTypeQname(newTypeQName);
permission.setName(newName);
}
// done
return updateCount;
return 1;
}
}
}