diff --git a/config/alfresco/encryption-context.xml b/config/alfresco/encryption-context.xml
index cc79bf6580..d1048874b5 100644
--- a/config/alfresco/encryption-context.xml
+++ b/config/alfresco/encryption-context.xml
@@ -84,6 +84,11 @@
+
+
+ metadata
+
+
diff --git a/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java b/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java
index 27d89c71d0..61fc43f30f 100644
--- a/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java
+++ b/source/java/org/alfresco/repo/security/person/PersonServiceImpl.java
@@ -55,7 +55,6 @@ import org.alfresco.repo.policy.PolicyComponent;
import org.alfresco.repo.search.SearcherException;
import org.alfresco.repo.security.authentication.AuthenticationException;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
-import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.repo.security.permissions.PermissionServiceSPI;
import org.alfresco.repo.tenant.TenantDomainMismatchException;
import org.alfresco.repo.tenant.TenantService;
@@ -69,8 +68,6 @@ import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.cmr.action.Action;
import org.alfresco.service.cmr.action.ActionService;
import org.alfresco.service.cmr.admin.RepoAdminService;
-import org.alfresco.service.cmr.admin.RepoUsage.UsageType;
-import org.alfresco.service.cmr.admin.RepoUsageStatus;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.invitation.InvitationException;
import org.alfresco.service.cmr.model.FileFolderService;
@@ -124,7 +121,6 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
private static final String LEAVE = "LEAVE";
public static final String SYSTEM_FOLDER_SHORT_QNAME = "sys:system";
public static final String PEOPLE_FOLDER_SHORT_QNAME = "sys:people";
- private static final String SYSTEM_USAGE_WARN_LIMIT_USERS_EXCEEDED_VERBOSE = "system.usage.err.limit_users_exceeded_verbose";
private static final String KEY_POST_TXN_DUPLICATES = "PersonServiceImpl.KEY_POST_TXN_DUPLICATES";
public static final String KEY_ALLOW_UID_UPDATE = "PersonServiceImpl.KEY_ALLOW_UID_UPDATE";
@@ -952,18 +948,6 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
throw new IllegalArgumentException("No username specified when creating the person.");
}
- /*
- * Check restrictions on the number of users
- */
- Long maxUsers = repoAdminService.getRestrictions().getUsers();
- if (maxUsers != null)
- {
- // Get the set of users created in this transaction
- Set usersCreated = TransactionalResourceHelper.getSet(KEY_USERS_CREATED);
- usersCreated.add(userName);
- AlfrescoTransactionSupport.bindListener(this);
- }
-
AuthorityType authorityType = AuthorityType.getAuthorityType(userName);
if (authorityType != AuthorityType.USER)
{
@@ -1258,16 +1242,6 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
beforeDeleteNodeValidationBehaviour.enable();
}
}
-
- /*
- * Kick off the transaction listener for create user. It has the side-effect of
- * recalculating the number of users.
- */
- Long maxUsers = repoAdminService.getRestrictions().getUsers();
- if (maxUsers != null)
- {
- AlfrescoTransactionSupport.bindListener(this);
- }
}
/**
@@ -2093,72 +2067,6 @@ public class PersonServiceImpl extends TransactionListenerAdapter implements Per
AlfrescoTransactionSupport.bindListener(this);
}
- /**
- * {@inheritDoc}
- */
- public void beforeCommit(boolean readOnly)
- {
- // check whether max users has been exceeded
- RunAsWork getMaxUsersWork = new RunAsWork()
- {
- @Override
- public Long doWork() throws Exception
- {
- return repoAdminService.getRestrictions().getUsers();
- }
- };
- Long maxUsers = AuthenticationUtil.runAs(getMaxUsersWork, AuthenticationUtil.getSystemUserName());
- if(maxUsers == null)
- {
- return;
- }
-
- Long users = AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork()
- {
- public Long doWork() throws Exception
- {
- repoAdminService.updateUsage(UsageType.USAGE_USERS);
- if(logger.isDebugEnabled())
- {
- logger.debug("Number of users is " + repoAdminService.getUsage().getUsers());
- }
- return repoAdminService.getUsage().getUsers();
- }
- } , AuthenticationUtil.getSystemUserName());
-
- // Get the set of users created in this transaction
- Set usersCreated = TransactionalResourceHelper.getSet(KEY_USERS_CREATED);
-
- // If we exceed the limit, generate decent message about which users were being created, etc.
- if (users > maxUsers)
- {
- List usersMsg = new ArrayList(5);
- int i = 0;
- for (String userCreated : usersCreated)
- {
- i++;
- if (i > 5)
- {
- usersMsg.add(" ... more");
- break;
- }
- else
- {
- usersMsg.add(userCreated);
- }
- }
- if (logger.isDebugEnabled())
- {
- logger.debug("Maximum number of users exceeded: " + usersCreated);
- }
- throw AlfrescoRuntimeException.create(SYSTEM_USAGE_WARN_LIMIT_USERS_EXCEEDED_VERBOSE, maxUsers, usersMsg);
- }
-
- // Get the usages and log any warnings
- RepoUsageStatus usageStatus = repoAdminService.getUsageStatus();
- usageStatus.logMessages(logger);
- }
-
public int countPeople()
{
NodeRef peopleContainer = getPeopleContainer();