1

Within the Sitecore User Manager it is possible to either enable or disable specific users. I have searched a lot around the Internet to find a way to access this property programatically in C#, just as you can access the built-in property IsAdministrator like this:

Sitecore.Context.User.Profile.IsAdministrator

But I can't seem to find anything close to it!

So I would like to know if it is possible to access a property like IsActive.

Thaks for your help!

Zappel
  • 1,612
  • 1
  • 22
  • 37

3 Answers3

3

Assuming you are using the default providers, Sitecore just uses standard ASP.NET Membership. The Sitecore API doesn't appear to expose this property, but it's very easy to get at:

System.Web.Security.MembershipUser membershipuser = System.Web.Security.Membership.GetUser(username);

Now check membershipuser.IsLockedOut.

Bryan
  • 8,748
  • 7
  • 41
  • 62
0

Assuming you are on a version 6.x installation, I believe that the Profile property is enumerable (and indexable using ["IsActive"]).

See the Security API Cookbook on SDN for more details: http://sdn.sitecore.net/upload/sitecore6/sc61keywords/security_api_cookbook_a4.pdf (chapter 3.3 for example).

Andreas Bergström
  • 713
  • 1
  • 5
  • 18
-1

if you want to access private properties, this could be useful

Find a private field with Reflection?

Community
  • 1
  • 1
Felipe Buccioni
  • 19,109
  • 2
  • 28
  • 28