Exemple #1
0
 public UserClass GetUserClass(UserInfo user)
 {
     if (user == null || user.PortalUserId == 0 || string.IsNullOrWhiteSpace(user.UserId))
     {
         return(UserClass.Unknown);
     }
     return(PortalUsersRepository.GetUserClass(user));
 }
Exemple #2
0
        public ModelResponse LoadProfile(UserInfo user, long portalUserId)
        {
            OrgVm r;

            try
            {
                //Authorization
                if (user == null)
                {
                    return(new ModelResponse(101));
                }
                if (string.IsNullOrWhiteSpace(user.UserId))
                {
                    return(new ModelResponse(101));
                }
                if (user.PortalUserId != portalUserId)
                {
                    if (!DalFactory.Singleton.DataService.IsAdmin(user.UserId))
                    {
                        return(new ModelResponse(101));
                    }
                }
                else
                {
                    var userClass = PUserRepo.GetUserClass(user);
                    if (userClass != UserClass.OrgAdmin && userClass != UserClass.OrgContact)
                    {
                        return(new ModelResponse(101));
                    }
                }

                //Load from DB
                r = Repo.LoadProfile(portalUserId);
            }
            catch (Exception ex)
            {
                return(new ModelResponse(ex));
            }

            return(new ModelResponse(0, r));
        }