Commit f3c6afb7 authored by michael.simon's avatar michael.simon
Browse files

Rule update for ucb example

parent a29689ed
......@@ -2,9 +2,36 @@ package edu.kit.scc.webreg.dools.unicluster
import edu.kit.scc.webreg.entity.UserEntity;
import edu.kit.scc.webreg.drools.UnauthorizedUser;
import edu.kit.scc.webreg.entity.RegistryEntity;
import edu.kit.scc.webreg.entity.as.ASUserAttrEntity;
import edu.kit.scc.webreg.entity.as.ASUserAttrValueStringEntity;
import java.util.Date;
global org.slf4j.Logger logger;
rule "AA Attribute test"
when
$user : UserEntity( $userAttrs : userAttrs )
$userAttr : ASUserAttrEntity( attributeSource.name == "UC-StatsAccess", $values : values ) from $userAttrs
ASUserAttrValueStringEntity( key == "result" && valueString == "1" ) from $values
then
logger.info( "Insert positive result String for user {}", $user.getEppn() );
insert( new String ("umfrage-is-set") );
end
rule "AA String test"
when
not ( String( this == "umfrage-is-set" ) )
$date : Date()
$registry : RegistryEntity( ($date.getTime() - agreedTime.getTime()) > 14*24*60*60*1000 )
then
logger.info( "Umfrage is not set or too old" );
insert( new UnauthorizedUser(null, "no-umfrage") );
end
rule "Email is set"
when
......@@ -76,4 +103,4 @@ rule "Home UID is set"
logger.info( "Home UID for user {} is missing", $user.getEppn() );
insert( new UnauthorizedUser($user, "home-uid-missing") );
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