开发者

Getting access to IsActive property in Sitecore

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!


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.


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).


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

Find a private field with Reflection?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜