Skip to content

Commit 4c84b81

Browse files
committed
Merge branch 'rc' of https://github.com/bexis2/core into rc
2 parents 07e3017 + 114e176 commit 4c84b81

File tree

4 files changed

+39
-21
lines changed

4 files changed

+39
-21
lines changed

Components/App/BExIS.App.Bootstrap/Attributes/CustomValidateAntiForgeryToken.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ public void OnAuthorization(AuthorizationContext filterContext)
2424
formToken = request.Headers["__RequestVerificationToken"];
2525
}
2626

27-
AntiForgery.Validate(cookieToken, formToken);
27+
if (cookieToken != null)
28+
{
29+
AntiForgery.Validate(cookieToken, formToken);
30+
}
31+
2832
//AntiForgery.Validate();
2933
}
3034
}

Console/BExIS.Web.Shell/Areas/DCM/BExIS.Modules.Dcm.UI/Controllers/FormController.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2767,7 +2767,6 @@ private string storeGeneratedFilePathToContentDiscriptor(long datasetId, Dataset
27672767
/// Is called when the user write a letter in Autocomplete User Component
27682768
/// </summary>
27692769
[HttpPost]
2770-
[CustomValidateAntiForgeryToken]
27712770
public ActionResult _AutoCompleteAjaxLoading(string text, long id, string type)
27722771
{
27732772
// if mapping with etities exits
@@ -3247,7 +3246,6 @@ private void validationAgainstJsonSchema()
32473246

32483247
//XX number of index des values nötig
32493248
[HttpPost]
3250-
[CustomValidateAntiForgeryToken]
32513249
public ActionResult ValidateMetadataAttributeUsage(string value, int id, int parentid, string parentname, int number, int parentModelNumber, int parentStepId, long entityId)
32523250
{
32533251
//delete all white spaces from start and end
@@ -3337,7 +3335,6 @@ public ActionResult ValidateMetadataAttributeUsage(string value, int id, int par
33373335
}
33383336

33393337
[HttpPost]
3340-
[CustomValidateAntiForgeryToken]
33413338
public ActionResult ValidateMetadataParameterUsage(string value, int id, long attrUsageId, int number, int parentModelNumber, int parentStepId, long entityId)
33423339
{
33433340
//delete all white spaces from start and end

Modules/DIM/BExIS.Dim.Helper/Mappings/MappingUtils.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,8 +1493,7 @@ public static XmlDocument GetConceptOutput(long metadataStructureId, long concep
14931493
//var simpleElements = metadata.SelectNodes(t);
14941494
if ((simpleElements == null || simpleElements.Count() == 0) && string.IsNullOrEmpty(complexMapping.Source.XPath) && complexMapping.Source.Name.ToLower().Equals("default")) // DEFAULT
14951495
{
1496-
1497-
string simpleTargetPath = complexTargetPath + "/"+ sTargetLinkElement.XPath + "[" + index + "]";
1496+
string simpleTargetPath = mergeXPaths(complexTargetPath, cTargetLinkElement.XPath, sTargetLinkElement.XPath + "[" + index + "]");
14981497

14991498
if (xTarget == null)
15001499
xTarget = XmlUtility.GenerateNodeFromXPath(concept, concept.DocumentElement, complexTargetPath); // generate target
@@ -1593,6 +1592,23 @@ private static string mergeXPaths(string directParent,string defaultParentPath,
15931592
return directParent + "/" + child.Replace(defaultParentPath, "").TrimStart('/');
15941593

15951594
}
1595+
// check if two xpath start with the same path
1596+
private static bool startWithSameXPath(string path1, string path2)
1597+
{
1598+
if (string.IsNullOrEmpty(path1) || string.IsNullOrEmpty(path2)) return false;
1599+
1600+
List<string> levelOfPath1 = path1.Split('/').ToList();
1601+
List<string> levelOfPath2 = path2.Split('/').ToList();
1602+
1603+
int minLevel = Math.Min(levelOfPath1.Count(), levelOfPath2.Count());
1604+
1605+
for (int i = 0; i < minLevel; i++)
1606+
{
1607+
if (!levelOfPath1[i].Equals(levelOfPath2[i])) return false;
1608+
}
1609+
1610+
return true;
1611+
}
15961612

15971613
private static string mergeXPaths(string directComplexSourceParent, string directSimpleSourcePath, string directTargetPath,string defaultTargetPath, string child, XmlDocument metadata)
15981614
{
@@ -1604,7 +1620,8 @@ private static string mergeXPaths(string directComplexSourceParent, string direc
16041620

16051621
if (directComplexSourceParent.Equals(directSimpleSourcePath)) // simple xpath need index
16061622
{
1607-
return directTargetPath;
1623+
//merge directTargetPath with child to get the child path with index
1624+
return mergeXPaths(directTargetPath,defaultTargetPath,child);
16081625
}
16091626

16101627
List<string> levelOfSource = directSimpleSourcePath.Replace(directComplexSourceParent,"").Split('/').ToList(); // level 2

database update scripts/4.0.2-4.1.0.sql

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,11 +1051,11 @@ DECLARE
10511051
BEGIN
10521052
IF NOT EXISTS (
10531053
SELECT 1 FROM public.dim_mappingkeys
1054-
WHERE xpath = 'data/attributes/subjects/subject' AND parentref = (select id from public.dim_mappingkeys where xpath = 'data/attributes/subject' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite'))
1054+
WHERE xpath = 'data/attributes/subjects/subject' AND parentref = (select id from public.dim_mappingkeys where xpath = 'data/attributes/subjects' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite'))
10551055
) THEN
10561056

10571057
INSERT INTO public.dim_mappingkeys (name, description, url, optional, iscomplex, xpath, concept, parentref)
1058-
VALUES ('Subject', '', '', false, false, 'data/attributes/subjects/subject', (select id from public.dim_mappingconcepts where name = 'DataCite'), (select id from public.dim_mappingkeys where xpath = 'data/attributes/subject' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite')));
1058+
VALUES ('Subject', '', '', false, false, 'data/attributes/subjects/subject', (select id from public.dim_mappingconcepts where name = 'DataCite'), (select id from public.dim_mappingkeys where xpath = 'data/attributes/subjects' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite')));
10591059

10601060
GET DIAGNOSTICS cnt = ROW_COUNT;
10611061
RAISE NOTICE 'Inserted % rows', cnt;
@@ -1071,11 +1071,11 @@ DECLARE
10711071
BEGIN
10721072
IF NOT EXISTS (
10731073
SELECT 1 FROM public.dim_mappingkeys
1074-
WHERE xpath = 'data/attributes/subjects/subjectScheme' AND parentref = (select id from public.dim_mappingkeys where xpath = 'data/attributes/subject' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite'))
1074+
WHERE xpath = 'data/attributes/subjects/subjectScheme' AND parentref = (select id from public.dim_mappingkeys where xpath = 'data/attributes/subjects' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite'))
10751075
) THEN
10761076

10771077
INSERT INTO public.dim_mappingkeys (name, description, url, optional, iscomplex, xpath, concept, parentref)
1078-
VALUES ('SubjectScheme', '', '', true, false, 'data/attributes/subjects/subjectScheme', (select id from public.dim_mappingconcepts where name = 'DataCite'), (select id from public.dim_mappingkeys where xpath = 'data/attributes/subject' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite')));
1078+
VALUES ('SubjectScheme', '', '', true, false, 'data/attributes/subjects/subjectScheme', (select id from public.dim_mappingconcepts where name = 'DataCite'), (select id from public.dim_mappingkeys where xpath = 'data/attributes/subjects' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite')));
10791079

10801080
GET DIAGNOSTICS cnt = ROW_COUNT;
10811081
RAISE NOTICE 'Inserted % rows', cnt;
@@ -1091,11 +1091,11 @@ DECLARE
10911091
BEGIN
10921092
IF NOT EXISTS (
10931093
SELECT 1 FROM public.dim_mappingkeys
1094-
WHERE xpath = 'data/attributes/subjects/schemeUri' AND parentref = (select id from public.dim_mappingkeys where xpath = 'data/attributes/subject' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite'))
1094+
WHERE xpath = 'data/attributes/subjects/schemeUri' AND parentref = (select id from public.dim_mappingkeys where xpath = 'data/attributes/subjects' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite'))
10951095
) THEN
10961096

10971097
INSERT INTO public.dim_mappingkeys (name, description, url, optional, iscomplex, xpath, concept, parentref)
1098-
VALUES ('SchemeUri', '', '', true, false, 'data/attributes/subjects/schemeUri', (select id from public.dim_mappingconcepts where name = 'DataCite'), (select id from public.dim_mappingkeys where xpath = 'data/attributes/subject' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite')));
1098+
VALUES ('SchemeUri', '', '', true, false, 'data/attributes/subjects/schemeUri', (select id from public.dim_mappingconcepts where name = 'DataCite'), (select id from public.dim_mappingkeys where xpath = 'data/attributes/subjects' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite')));
10991099

11001100
GET DIAGNOSTICS cnt = ROW_COUNT;
11011101
RAISE NOTICE 'Inserted % rows', cnt;
@@ -1111,11 +1111,11 @@ DECLARE
11111111
BEGIN
11121112
IF NOT EXISTS (
11131113
SELECT 1 FROM public.dim_mappingkeys
1114-
WHERE xpath = 'data/attributes/subjects/valueUri' AND parentref = (select id from public.dim_mappingkeys where xpath = 'data/attributes/subject' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite'))
1114+
WHERE xpath = 'data/attributes/subjects/valueUri' AND parentref = (select id from public.dim_mappingkeys where xpath = 'data/attributes/subjects' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite'))
11151115
) THEN
11161116

11171117
INSERT INTO public.dim_mappingkeys (name, description, url, optional, iscomplex, xpath, concept, parentref)
1118-
VALUES ('ValueUri', '', '', true, false, 'data/attributes/subjects/valueUri', (select id from public.dim_mappingconcepts where name = 'DataCite'), (select id from public.dim_mappingkeys where xpath = 'data/attributes/subject' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite')));
1118+
VALUES ('ValueUri', '', '', true, false, 'data/attributes/subjects/valueUri', (select id from public.dim_mappingconcepts where name = 'DataCite'), (select id from public.dim_mappingkeys where xpath = 'data/attributes/subjects' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite')));
11191119

11201120
GET DIAGNOSTICS cnt = ROW_COUNT;
11211121
RAISE NOTICE 'Inserted % rows', cnt;
@@ -1131,11 +1131,11 @@ DECLARE
11311131
BEGIN
11321132
IF NOT EXISTS (
11331133
SELECT 1 FROM public.dim_mappingkeys
1134-
WHERE xpath = 'data/attributes/subjects/lang' AND parentref = (select id from public.dim_mappingkeys where xpath = 'data/attributes/subject' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite'))
1134+
WHERE xpath = 'data/attributes/subjects/lang' AND parentref = (select id from public.dim_mappingkeys where xpath = 'data/attributes/subjects' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite'))
11351135
) THEN
11361136

11371137
INSERT INTO public.dim_mappingkeys (name, description, url, optional, iscomplex, xpath, concept, parentref)
1138-
VALUES ('Language', '', '', true, false, 'data/attributes/subjects/lang', (select id from public.dim_mappingconcepts where name = 'DataCite'), (select id from public.dim_mappingkeys where xpath = 'data/attributes/subject' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite')));
1138+
VALUES ('Language', '', '', true, false, 'data/attributes/subjects/lang', (select id from public.dim_mappingconcepts where name = 'DataCite'), (select id from public.dim_mappingkeys where xpath = 'data/attributes/subjects' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite')));
11391139

11401140
GET DIAGNOSTICS cnt = ROW_COUNT;
11411141
RAISE NOTICE 'Inserted % rows', cnt;
@@ -1151,11 +1151,11 @@ DECLARE
11511151
BEGIN
11521152
IF NOT EXISTS (
11531153
SELECT 1 FROM public.dim_mappingkeys
1154-
WHERE xpath = 'data/attributes/subjects/classificationCode' AND parentref = (select id from public.dim_mappingkeys where xpath = 'data/attributes/subject' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite'))
1154+
WHERE xpath = 'data/attributes/subjects/classificationCode' AND parentref = (select id from public.dim_mappingkeys where xpath = 'data/attributes/subjects' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite'))
11551155
) THEN
11561156

11571157
INSERT INTO public.dim_mappingkeys (name, description, url, optional, iscomplex, xpath, concept, parentref)
1158-
VALUES ('ClassificationCode', '', '', true, false, 'data/attributes/subjects/classificationCode', (select id from public.dim_mappingconcepts where name = 'DataCite'), (select id from public.dim_mappingkeys where xpath = 'data/attributes/subject' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite')));
1158+
VALUES ('ClassificationCode', '', '', true, false, 'data/attributes/subjects/classificationCode', (select id from public.dim_mappingconcepts where name = 'DataCite'), (select id from public.dim_mappingkeys where xpath = 'data/attributes/subjects' AND concept = (select id from public.dim_mappingconcepts where name = 'DataCite')));
11591159

11601160
GET DIAGNOSTICS cnt = ROW_COUNT;
11611161
RAISE NOTICE 'Inserted % rows', cnt;
@@ -2275,7 +2275,7 @@ BEGIN
22752275
) THEN
22762276

22772277
INSERT INTO public.dim_mappingkeys (name, description, url, optional, iscomplex, xpath, concept)
2278-
VALUES ('fFndingReferences', '', '', true, true, 'data/attributes/fundingReferences', (select id from public.dim_mappingconcepts where name = 'DataCite'));
2278+
VALUES ('fundingReferences', '', '', true, true, 'data/attributes/fundingReferences', (select id from public.dim_mappingconcepts where name = 'DataCite'));
22792279

22802280
GET DIAGNOSTICS cnt = ROW_COUNT;
22812281
RAISE NOTICE 'Inserted % rows', cnt;
@@ -2529,4 +2529,4 @@ INSERT INTO public.versions(
25292529
versionno, extra, module, value, date)
25302530
VALUES (1, null, 'Shell', '4.1.0',NOW());
25312531

2532-
commit;
2532+
commit;

0 commit comments

Comments
 (0)