mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-92: Prevent users from being able to create duplicate lists
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/BRANCHES/V2.0@38290 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -2,6 +2,10 @@
|
||||
|
||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||
{
|
||||
"data": <@rmconstraintLib.constraintJSON constraint=constraint />
|
||||
<#if !errorMessage??>
|
||||
"data": <@rmconstraintLib.constraintJSON constraint=constraint />
|
||||
<#else>
|
||||
"message" : "${msg(errorMessage, title)}"
|
||||
</#if>
|
||||
}
|
||||
</#escape>
|
@@ -19,7 +19,7 @@ function main()
|
||||
{
|
||||
for (var x = 0; x < values.length(); x++)
|
||||
{
|
||||
allowedValues[i++] = values.get(x);
|
||||
allowedValues[i++] = values.get(x);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,10 +38,33 @@ function main()
|
||||
title = name;
|
||||
}
|
||||
|
||||
var constraint = caveatConfig.createConstraint(name, title, allowedValues);
|
||||
|
||||
var constraints = caveatConfig.allConstraints;
|
||||
|
||||
// Pass the constraint detail to the template
|
||||
model.constraint = constraint;
|
||||
// Check for existing constraint...
|
||||
var alreadyExists = false;
|
||||
for (var i=0; i<constraints.length; i++)
|
||||
{
|
||||
var currTitle = constraints[i].title;
|
||||
if (currTitle + "" == title)
|
||||
{
|
||||
alreadyExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var existingConstraint = caveatConfig.getConstraint(title);
|
||||
if (!alreadyExists)
|
||||
{
|
||||
var constraint = caveatConfig.createConstraint(name, title, allowedValues);
|
||||
model.constraint = constraint;
|
||||
}
|
||||
else
|
||||
{
|
||||
status.code = 400;
|
||||
model.errorMessage = "rm.admin.list-already-exists";
|
||||
model.title = title;
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
Reference in New Issue
Block a user