DM User Usages/Quotas - fixes to prevent negative quota and to allow editing to be finished after an error

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8020 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jan Vonka
2008-01-18 15:05:16 +00:00
parent e08a3d8502
commit 5e933c75b9
4 changed files with 45 additions and 13 deletions

View File

@@ -758,12 +758,20 @@ public class CreateUserWizard extends BaseWizardBean
if (logger.isDebugEnabled())
logger.debug("Created User Authentication instance for username: " + this.userName);
putSizeQuotaProperty(this.userName, this.sizeQuota, this.sizeQuotaUnits);
if ((this.sizeQuota != null) && (this.sizeQuota < 0L))
{
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(context, UsersDialog.ERROR_NEGATIVE_QUOTA), this.sizeQuota));
outcome = null;
}
else
{
putSizeQuotaProperty(this.userName, this.sizeQuota, this.sizeQuotaUnits);
}
}
else
{
outcome = null;
Utils.addErrorMessage(Application.getMessage(context, UsersDialog.ERROR_PASSWORD_MATCH));
outcome = null;
}
invalidateUserList();
}
@@ -792,11 +800,19 @@ public class CreateUserWizard extends BaseWizardBean
protected void putSizeQuotaProperty(String userName, Long quota, String quotaUnits)
{
if ((quota != null) && (quota > 0))
if (quota != null)
{
quota = convertToBytes(quota, quotaUnits);
if (quota >= 0L)
{
quota = convertToBytes(quota, quotaUnits);
}
else
{
// ignore negative quota
return;
}
}
this.contentUsageService.setUserQuota(userName, (quota == null ? -1 : quota));
}