PTPrinciple.IsInRole

PTPrinciple.IsInRole

Old forum URL: forums.lhotka.net/forums/t/3190.aspx


Franzakie posted on Saturday, July 14, 2007

Hi Everyone,

I Changed the PTPricipal.cs class so the IsInRole method looks like this.

Public override bool IsInRole(string role)
{
    PTIdentity identity = (PTIdentity)this.Identity;
//    return identity.IsInRole(role);
    Return true;
}

In the UI I put code to trap this value by doing something like this.
Label1.Text = “The Administrator rights is: “ + Csla.ApplicationContext.User.IsInRole(“Administrator”);

Running the code I get

The Administrator rights is: False

This only tells me that the my PTpriciple is actually not overriding the Csla.ApplicationContext.User s’ IsInRole method.

Does anyone know what is going on here and how I can have this fixed – as every CanReadProperty, CanWriteProperty etc. are returning false on me.

Regards,

Super frustrated. - Franzakie

ajj3085 replied on Monday, July 16, 2007

Are you sure the thread's principal has been set at the point you're examining the IsInRole value?

Franzakie replied on Monday, July 16, 2007

Thanks for the response ajj3085,
Its quite evident that I’m new to the CSLA, ASP.Net when I’m not able to answer your question. As I just don’t know and don’t know how to check it.

I have however found a blog by Wooley (a guy blogging at  http://devauthority.com/blogs/jwooley/archive/2006/08/25/2207.aspx) basically described my problem in a piece called “Problems using roles authentication with a custom Principle”. He did not get or seem to find the answer to his problem, but reading through his blog, I found mine.

I did not have a GLOBAL.ASAX file :-\

Feeling really stupid,
Franzakie.

Copyright (c) Marimer LLC