public String createCondition ( Authentication authentication , Object privilegeKey , SpelTranslator translator ) { if ( ! hasPermission ( authentication , privilegeKey ) ) { throw new AccessDeniedException ( "Access is denied" ) ; } String roleKey = getRoleKey ( authentication ) ; Permission permission = getPermission ( roleKey , privilegeKey ) ; Subject subject = getSubject ( roleKey ) ; if ( ! RoleConstant . SUPER_ADMIN . equals ( roleKey ) && permission != null && permission . getResourceCondition ( ) != null ) { return translator . translate ( permission . getResourceCondition ( ) . getExpressionString ( ) , subject ) ; } return null ; }
Create condition with replaced subject variables .