[Policy-17] Removed the sql scripts from sdk app
[policy/engine.git] / ECOMP-PAP-REST / src / main / resources / Decision_GuardBLPolicyTemplate.xml
1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 <Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:d56af069-6cf1-430c-ba07-e26602e06a52" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:permit-unless-deny"> 
3     <Description>${description}</Description>
4     <Target>
5         <AnyOf>
6             <AllOf>
7                 <Match MatchId="org.openecomp.function.regex-match">
8                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">${PolicyName}</AttributeValue>
9                     <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="PolicyName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
10                 </Match>
11             </AllOf>
12             <AllOf>
13                 <Match MatchId="org.openecomp.function.regex-match">
14                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">${ECOMPName}</AttributeValue>
15                     <AttributeDesignator Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" AttributeId="ECOMPName" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
16                 </Match>
17                 <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
18                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">${actor}</AttributeValue>
19                     <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="actor" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
20                 </Match>
21                 <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
22                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">${recipe}</AttributeValue>
23                     <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="recipe" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
24                 </Match>
25             </AllOf>
26         </AnyOf>
27     </Target>
28     <Rule RuleId="urn:com:xacml:rule:id:284d9393-f861-4250-b62d-fc36640a363a" Effect="Permit">
29         <Target>
30             <AnyOf>
31                 <AllOf>
32                     <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
33                         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DECIDE</AttributeValue>
34                         <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
35                     </Match>
36                 </AllOf>
37             </AnyOf>
38         </Target>
39         <Condition>
40                         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:not">
41                                 <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
42                     <Apply FunctionId="urn:oasis:names:tc:xacml:2.0:function:time-in-range">
43                         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:time-one-and-only">
44                             <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:environment:current-time" DataType="http://www.w3.org/2001/XMLSchema#time" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment" MustBePresent="false"/>
45                         </Apply>
46                         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#time">${guardActiveStart}</AttributeValue>
47                         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#time">${guardActiveEnd}</AttributeValue>
48                     </Apply>
49                                         <Apply FunctionId="urn:oasis:names:tc:xacml:3.0:function:any-of">
50                                                 <Function FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"/>
51                                                         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
52                                                                 <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="target" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
53                                                         </Apply>
54                                                         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-bag">
55                                                                 <!-- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">vserver.vserver-name</AttributeValue>-->
56                                                                 ${blackListElement}
57                                                         </Apply>
58                                         </Apply>
59                 </Apply>
60             </Apply>
61         </Condition>
62     </Rule>
63     <Rule RuleId="urn:com:xacml:rule:id:284d9393-f861-4250-b62d-fc36640a363a" Effect="Deny">
64         <Target>
65             <AnyOf>
66                 <AllOf>
67                     <Match MatchId="urn:oasis:names:tc:xacml:3.0:function:string-equal-ignore-case">
68                         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">DECIDE</AttributeValue>
69                         <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action" AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
70                     </Match>
71                 </AllOf>
72             </AnyOf>
73         </Target>
74         <Condition>
75             <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:not">
76                 <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:not">
77                                         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:and">
78                                                 <Apply FunctionId="urn:oasis:names:tc:xacml:2.0:function:time-in-range">
79                                                         <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:time-one-and-only">
80                                                                 <AttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:environment:current-time" DataType="http://www.w3.org/2001/XMLSchema#time" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:environment" MustBePresent="false"/>
81                                                         </Apply>
82                                                         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#time">${guardActiveStart}</AttributeValue>
83                                                         <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#time">${guardActiveEnd}</AttributeValue>
84                                                 </Apply>
85                                                 <Apply FunctionId="urn:oasis:names:tc:xacml:3.0:function:any-of">
86                                                         <Function FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-equal"/>
87                                                                 <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-one-and-only">
88                                                                         <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="target" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
89                                                                 </Apply>
90                                                                 <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-bag">
91                                                                         <!-- <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">vserver.vserver-name</AttributeValue>-->
92                                                                         ${blackListElement}
93                                                                 </Apply>
94                                                 </Apply>
95                                         </Apply>
96                                 </Apply>
97             </Apply>
98         </Condition>
99         <AdviceExpressions>
100             <AdviceExpression AdviceId="GUARD_BL_YAML" AppliesTo="Deny">
101                 <AttributeAssignmentExpression AttributeId="guard.response" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource">
102                     <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Denied!</AttributeValue>
103                 </AttributeAssignmentExpression>
104             </AdviceExpression>
105         </AdviceExpressions>
106     </Rule>
107 </Policy>