mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-22 03:37:25 +08:00
Remove Orchard.Events reference
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
using Orchard.Conditions.Services;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Events;
|
||||
using Orchard.Roles.Models;
|
||||
using Orchard.Security;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Orchard.Roles.Conditions {
|
||||
public interface IConditionProvider : IEventHandler {
|
||||
void Evaluate(dynamic evaluationContext);
|
||||
}
|
||||
|
||||
public class RoleRuleProvider : IConditionProvider {
|
||||
private readonly IAuthenticationService _authenticationService;
|
||||
|
||||
@@ -13,7 +17,7 @@ namespace Orchard.Roles.Conditions {
|
||||
_authenticationService = authenticationService;
|
||||
}
|
||||
|
||||
public void Evaluate(ConditionEvaluationContext evaluationContext) {
|
||||
public void Evaluate(dynamic evaluationContext) {
|
||||
if (!String.Equals(evaluationContext.FunctionName, "role", StringComparison.OrdinalIgnoreCase)) {
|
||||
return;
|
||||
}
|
||||
@@ -24,7 +28,7 @@ namespace Orchard.Roles.Conditions {
|
||||
return;
|
||||
}
|
||||
|
||||
var roles = evaluationContext.Arguments.Cast<string>();
|
||||
var roles = ((object[])evaluationContext.Arguments).Cast<string>();
|
||||
var userRoles = user.As<IUserRoles>();
|
||||
evaluationContext.Result = userRoles != null ? userRoles.Roles.Intersect(roles).Count() > 0 : false;
|
||||
}
|
||||
|
||||
@@ -157,10 +157,6 @@
|
||||
<Name>Orchard.Core</Name>
|
||||
<Private>false</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Conditions\Orchard.Conditions.csproj">
|
||||
<Project>{98251eae-a41b-47b2-aa91-e28b8482da70}</Project>
|
||||
<Name>Orchard.Conditions</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Forms\Orchard.Forms.csproj">
|
||||
<Project>{642a49d7-8752-4177-80d6-bfbbcfad3de0}</Project>
|
||||
<Name>Orchard.Forms</Name>
|
||||
|
||||
Reference in New Issue
Block a user