Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
ew.levr.db.skyrepo.5.9.1.source-code.skyrepo.security.rs2 Maven / Gradle / Ivy
// Copyright 2015-2016 Eduworks Corporation and other contributing parties.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
encryptedTypes=#object(
a="http://skyrepo.eduworks.com/encryptedValue",
b="encryptedValue",
c="EncryptedValue",
d="http://schema.eduworks.com/ebac/0.2/encryptedValue",
e="http://schema.cassproject.org/kbac/0.2/EncryptedValue"
).valueSet();
#skyRepoPredefinedEncrypted = encryptedTypes;
type=#add(a="@",b="type",_string="true");
context=#add(a="@",b="context",_string="true");
owner=#add(a="@",b="owner",_string="true");
reader=#add(a="@",b="reader",_string="true");
protect=#add(a="@",b="protect",_string="true");
obj=#toObject(obj="@obj");
owners=#if(
operator="@owner",
operand="",
ne=#if(
operator=#startsWith(obj="@owner",with="["),
operand="true",
eq=#toArray(obj="@owner"),
ne=#add(_string="true",a="[",b="]").toArray().append(a="@owner")
)
).ccall(
owner=obj.getByParam(
param=owner
)
).cforEach(
paramName="owner",
array="true",
threaded="false",
op=#replace(
obj="@owner",
regex="true",
replace="\r?\n",
with=""
)
);
readers=#if(
operator="@reader",
operand="",
ne=#if(
operator=#startsWith(obj="@reader",with="["),
operand="true",
eq=#toArray(obj="@reader"),
ne=#add(_string="true",a="[",b="]").toArray().append(a="@reader")
)
).ccall(
reader=obj.getByParam(
param=reader
)
).cforEach(
paramName="reader",
array="true",
threaded="false",
op=#replace(
obj="@reader",
regex="true",
replace="\r?\n",
with=""
)
);
ownersOrReaders=#object(a=owners,b=readers).valueSet().union();
#owners=owners;
urlType=#add(_string="true",
a=obj.getByParam(param=context).string(op="trim",chars="/"),
b=#if(operator=obj.getByParam(param=context),operand="",ne="/"),
c=#replace(obj="@type",replace=obj.getByParam(param=context),with="").string(op="trim",chars="/")
);
types=obj.getByParam(param=type).toArray().cforEach(
paramName="type",
array="true",
threaded="false",
op=#if(
operator=#has(obj="@type",has="http"),
operand=true,
eq=urlType,
ne="@type"
)
);
isEncryptedType=#if(
operator=encryptedTypes.intersect(b=types).count(),
operand="0",
gt="true",
eq=#if(
operator=#httpGet(
obj="@typesCache"
).add(z=" ").cache(
global="true",
name=#add(_string="true",z="@typesCache",a="httpGet")
).toObject().getByParam(
param=protect
).catch(any=#object()).call(typesCache=types.getIndex(index="0")),
operand="true",
eq="true",
ne="false"
)
);
filterResultObject=#if(
operator=isEncryptedType,
operand="true",
eq=#if(
operator=ownersOrReaders.count(),
operand="0",
eq=obj.cforEach(
paramName="key",
valueName="obj",
threaded="false",
op=#filterResults()
),
ne=#if(
operator=#signatureSheet().intersect(b=ownersOrReaders).count(),
operand="0",
gt=obj.cforEach(
paramName="key",
valueName="obj",
threaded="false",
op=#filterResults()
)
)
),
ne=obj.cforEach(
paramName="key",
valueName="obj",
threaded="false",
op=#filterResults(obj="@obj", key="@key")
)
);
filterResultArray=#toArray(obj="@obj").cforEach(
paramName="obj",
threaded="false",
array="true",
op=#filterResults()
);
isObject=#if(
operator=#startsWith(obj="@obj",with="{"),
operand="true",
eq=#if(
operator=#endsWith(obj="@obj",with="}"),
operand="true",
eq=#toObject(obj="@obj").catch(any="")
)
);
#isObject=isObject;
isArray=#if(
operator=#startsWith(obj="@obj",with="["),
operand="true",
eq=#if(
operator=#endsWith(obj="@obj",with="]"),
operand="true",
eq=#toArray(obj="@obj",wrapString="false").catch(any="")
)
);
#isArray=isArray;
filterResults=#if(
operator="@obj",
operand="",
ne=#if(
operator=isObject,
operand="",
ne=filterResultObject,
eq=#if(
operator=isArray,
operand="",
ne=filterResultArray,
eq="@obj"
)
)
);
filterResults=#if(
operator=#has(obj=#toLower(obj="@obj"),has="encrypted"),
operand="true",
eq=filterResults,
ne=#if(
operator="@obj",
operand="",
ne=#if(
operator=isObject,
operand="",
ne=#toObject(obj="@obj"),
eq=#if(
operator=isArray,
operand="",
ne=#toArray(obj="@obj"),
eq="@obj"
)
)
)
);
#filterResults=filterResults;