Beispiel #1
0
        public bool IsCurrentUserInRole(string role)
        {
            if (role == null)
            {
                throw new ArgumentNullException("role");
            }

            ApplicationServiceHelper.EnsureRoleServiceEnabled();
            return(Roles.IsUserInRole(role));
        }
        public Collection <string> SetPropertiesForCurrentUser(IDictionary <string, object> values, bool authenticatedUserOnly)
        {
            ApplicationServiceHelper.EnsureProfileServiceEnabled();

            HttpContext context = HttpContext.Current;

            if (authenticatedUserOnly)
            {
                ApplicationServiceHelper.EnsureAuthenticated(context);
            }

            return(ProfileService.SetProfile(context, values));
        }
        public Dictionary <string, object> GetPropertiesForCurrentUser(IEnumerable <string> properties, bool authenticatedUserOnly)
        {
            ApplicationServiceHelper.EnsureProfileServiceEnabled();

            HttpContext context = HttpContext.Current;

            if (authenticatedUserOnly)
            {
                ApplicationServiceHelper.EnsureAuthenticated(context);
            }

            return(ProfileService.GetProfile(context, properties));
        }
        public bool Login(string userName, string password, bool createPersistentCookie)
        {
            ApplicationServiceHelper.EnsureAuthenticationServiceEnabled(HttpContext.Current, true);

            //


            if (Membership.ValidateUser(userName, password))
            {
                FormsAuthentication.SetAuthCookie(userName, createPersistentCookie);
                return(true);
            }

            return(false);
        }
 public Collection <ProfilePropertyMetadata> GetPropertiesMetadata()
 {
     ApplicationServiceHelper.EnsureProfileServiceEnabled();
     return(ApplicationServiceHelper.GetProfilePropertiesMetadata());
 }
 public bool IsLoggedIn()
 {
     ApplicationServiceHelper.EnsureAuthenticationServiceEnabled(HttpContext.Current, false);
     return(HttpContext.Current.Request.IsAuthenticated);
 }
 public void Logout()
 {
     ApplicationServiceHelper.EnsureAuthenticationServiceEnabled(HttpContext.Current, false);
     FormsAuthentication.SignOut();
 }
Beispiel #8
0
 public string[] GetRolesForCurrentUser()
 {
     ApplicationServiceHelper.EnsureRoleServiceEnabled();
     return(Roles.GetRolesForUser());
 }