Memflex icon indicating copy to clipboard operation
Memflex copied to clipboard

Question: Using Attributes with roles (Answered)

Open rickardliljeberg opened this issue 11 years ago • 2 comments

Should stuff like this work? [Authorize(Roles="UberAdmin,AccountAdmin,LicenseAdmin")]

I can't get it to work, and I am wondering if it should work before I dig deeper.

rickardliljeberg avatar Apr 23 '13 10:04 rickardliljeberg

The built-n authoize attributes doesn't look at memflex since memfle doesn't plug into the traditional asp.net role provider stuff. You'd have to write a custom filter (see LogMeIn\filters\FlexAuthorizeAttribute.cs).

Note that sample assumes an IFlexRoleProvider can be property injected into the filter, which the LogMeIn sample is setup to do using StructureMap, so you'd either need a custom dependency resolver or hard code the role provider.

Hope that makes sense,

OdeToCode avatar Apr 23 '13 12:04 OdeToCode

Excellent, I was hoping I had only missed something simple.

Thanks!

On 23 April 2013 14:28, K. Scott Allen [email protected] wrote:

The built-n authoize attributes doesn't look at memflex since memfle doesn't plug into the traditional asp.net role provider stuff. You'd have to write a custom filter (see LogMeIn\filters\FlexAuthorizeAttribute.cs).

Note that sample assumes an IFlexRoleProvider can be property injected into the filter, which the LogMeIn sample is setup to do using StructureMap, so you'd either need a custom dependency resolver or hard code the role provider.

Hope that makes sense,

— Reply to this email directly or view it on GitHubhttps://github.com/OdeToCode/Memflex/issues/31#issuecomment-16854951 .

rickardliljeberg avatar Apr 23 '13 13:04 rickardliljeberg