Help get this topic noticed by sharing it on Twitter, Facebook, or email.

DACL how to pass field value

I am trying to create access control rules but do not know how to pass a value from the actual table. I am configuring an access control rule that will fire only when the controller is accessed as a lookup from a specific view. I have a tag in place so I can identify when the controller is accessed from this specific view. So below I have the rule working correctly based on UserId. I need to change this to where I can pass AgentID from the current record that is doing the lookup into this access control rule. Can you please provide the correct syntax?

protected override void EnumerateDynamicAccessControlRules(string controllerName)
{
if (IsTagged("MyBilling"))
{
RegisterAccessControlRule("WorkOrderProspectID", @"
SELECT dbo.vAuthorizedProspects.ProspectID
FROM dbo.vAuthorizedProspects
where dbo.vAuthorizedProspects.AgentID = @AgentID
",
AccessPermission.Allow, new SqlParam("@AgentID", UserId));
}
}
1 person has
this question
+1
Reply