Commit 85e5b4b1 authored by michael.simon's avatar michael.simon
Browse files

update sample rules

parent 9210055e
package edu.kit.scc.webreg.dools.unicluster
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.entity.RegistryEntity;
import edu.kit.scc.webreg.drools.UnauthorizedUser;
import edu.kit.scc.webreg.entity.as.ASUserAttrEntity;
import edu.kit.scc.webreg.entity.as.ASUserAttrValueStringEntity;
global org.slf4j.Logger logger;
rule "AA Attribute test"
when
$user : UserEntity( $userAttrs : userAttrs )
$userAttr : ASUserAttrEntity( attributeSource.name == "TestHttp1", $values : values ) from $userAttrs
ASUserAttrValueStringEntity( key == "key1" && valueString == "value1" ) from $values
then
logger.info( "Insert AA String for user {}", $user.getEppn() );
insert( new String ("aa-is-set") );
end
rule "AA String test"
when
not ( String( this == "aa-is-set" ) )
then
logger.info( "String is not set" );
insert( new UnauthorizedUser(null, "no-access") );
end
......@@ -11,9 +11,9 @@ global org.slf4j.Logger logger;
rule "Registry old"
when
Date( $t: time ) from new Date()
$registry : RegistryEntity( $t after[30d] agreedTime )
$date : Date()
$registry : RegistryEntity( ($date.getTime() - agreedTime.getTime()) > 30*24*60*1000 )
then
logger.info( "Date is more than 30d before now" );
end
end
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment