SECDW2Dimension
transformation SECDW2Dimensions(SECDW pim, Dimensions psm){
top relation Package2DimensionFiles{
checkonly domain pim p:Package{
name = n; ownedMembers }
enforce domain psm df:DimensionFiles{
name = n;
ownedDimensions = OWNDIMS:Set(Dimension); }
where{
OWNMEMB->forAll(sd:SDimension | SDimension2Dimension(df,sd)); }
}
relation SDimension2Dimension{
enforce domain psm df:DimensionFiles{
name = n; }
checkonly domain pim sd:SDimension{
name = sdName;
securityLevels = SECLEVS:Set(SLevel);
securityRoles = SECROLS:Set(SRole);
securityCompartments = SECCOMPS:Set(SCompartment);
ownedAttribute = OWNATTR:Set(Property); }
enforce domain psm d:Dimension{
ID = sdName; Name = sdName; }
when{ n = sd.owner.name; }
where{
SDimension.owner.owner->forAll(sc:SCompartment |
createDimensionSIARForSCompartment(sc,d));
SECCOMPS->forAll(sc:SCompartment |
authorizeSCompartment(sc,tempSCompartment));
SDimension.owner.owner->forAll(sr:SRole |
createDimensionSIARForSRole(sr,d));
SECROLS->forAll(sr:SRole |
getLeafSecurityRoles(sr)->forAll(tempSRole:SRole |
authorizeSRole(d,tempSRole));
SDimension.owner.owner->forAll(sl:SLevel |
createDimensionSIARForSLevel(sl,d));
SECLEVS->forAll(sl:SLevel |
getUpperSecurityLevels(sl)->forAll(tempSLevel:SLevel |
authorizeSLevel(d,tempSLevel));
OWNATTR->select(oclIsKindOf(SecureProperty))->
forAll(sp:SecureProperty | processSecureProperty(sd,d,sp)) }
}
relation KeyProperty2KeyAttribute {…}
relation NonKeyProperty2Attribute {…}
relation SBase2Attributes {…}
relation createDimensionSIARForSCompartment{
checkonly domain pim sc:SCompartment{ name = compartmentName; }
enforce domain pim d:Dimension{
name = dimName;
ownedDimensionPermissions = OWNDIMPERMS:Set(DimensionPermission); }
enforce domain psm ap:DimensionPermission{
ID = "DimensionPermission" + compartmentName;
Name = "DimensionPermission" + compartmentName;
RoleID = compartmentName; }
}
relation createDimensionSIARForSRole{
checkonly domain pim sr:SRole{ name = roleName; }
enforce domain pim d:Dimension{
name = dimName;
ownedDimensionPermissions = OWNDIMPERMS:Set(DimensionPermission); }
enforce domain psm ap:DimensionPermission{
ID = "DimensionPermission" + roleName;
Name = "DimensionPermission" + roleName;
RoleID = roleName; }
}
relation createDimensionSIARForSLevel{
checkonly domain pim Sl:SLevel{ name = levelName; }
enforce domain pim d:Dimension{
name = dimName;
ownedDimensionPermissions = OWNDIMPERMS:Set(DimensionPermission); }
enforce domain psm ap:DimensionPermission{
ID = "DimensionPermission" + levelName;
Name = "DimensionPermission" + levelName;
RoleID = levelName; }
}
relation authorizeSCompartment {…}
relation authorizeSRole{
enforce domain psm d:Dimension{
name = n;
ownedDimensionPermissions = OWNDIMPERMS:Set(DimensionPermission); }
checkonly domain pim sr:SRole{
name = sRolName; }
where{
let authDimPer:DimensionPermission = OWNDIMPERMS->
select(ID = ("DimensionPermission"+sRolName)) in
authDimPer.Read = "Allowed"; authDimPer.Process = "true"; }
}
relation authorizeSLevel{
enforce domain psm d:Dimension{
name = n;
ownedDimensionPermissions = OWNDIMPERMS:Set(DimensionPermission); }
checkonly domain pim sl:SLevel{ name = slevelName; }
where{
let authDimPer:DimensionPermission = OWNDIMPERMS->
select(ID = ("DimensionPermission"+slevelName)) in
authDimPer.Read = "Allowed"; authDimPer.Process = "true"; }
}
relation processSecureProperty{
checkonly domain pim sd:SDimension{
name = n; }
enforce domain psm d:Dimension{
name = n;
ownedDimensionPermissions = OWNDIMPER:Set(DimensionPermission); }
checkonly domain pim sp:SecureProperty{
name = spName;
securityLevels = SECLEVS:Set(SLevel);
securityRoles = SECROLS:Set(SRole);
securityCompartments = SECCOMPS:Set(SCompartment); }
where{
SECLEVS->forAll(sl:SLevel |
getUpperLevels(sl)->forAll(tmpSLevel:SLevel |
createPositiveAttributePermisions(d.ownedDimensionPermisions->
select(ID=("DimensionPermission"+tmpSLevel.name)),sp);
getLowerLevels(sl)-> forAll(tmpSLevel:SLevel |
createNegativeAttributePermisions(d.ownedDimensionPermisions->
select(ID=("DimensionPermission"+tmpSLevel.name)),sp);
SECROLS->forAll(sr:SRole |
getLeafSRoles(sr)->forAll(tmpSRole:SRole |
createPositiveAttributePermisions (d.ownedDimensionPermisions->
select(ID=("DimensionPermission"+tmpSRole.name)),sp);
getNonLeafRoles(sr)->forAll(tmpSRole:SRole |
createNegativeAttributePermisions(d.ownedDimensionPermisions->
select(ID=("DimensionPermission"+tmpSRole.name)),sp);
SECLEVS->forAll(sc:SCompartment |
createPositiveAttributePermisions (d.ownedDimensionPermisions->
select(ID=("DimensionPermission"+sl.name)),sp); }
}
relation createPositiveAttributePermisions{
checkonly domain pim sp:SecureProperty{
name = spName; }
enforce domain psm dp:DimensionPermission{
ID = "DimensionPermission"+ID;
Name = "DimensionPermission"+ID;
ownedAttributePermissions = OWNATTPERMS:Set(AttributePermission); }
enforce domain psm at:AttributePermission{
AttributeID = spName; }
}
relation createNegativeAttributePermissions{
checkonly domain pim sp:SecureProperty{
name = spName; }
enforce domain psm dp:DimensionPermission{
ID = "DimensionPermission"+ID;
Name = "DimensionPermission"+ID;
ownedAttributePermissions = OWNATTPERMS:Set(AttributePermission); }
enforce domain psm at:AttributePermission{
AttributeID = spName;
DeniedSet = "["+sp.class.name+"].["+sp.name+"]"; }
}