public UserClass GetUserClass(UserInfo user) { if (user == null || user.PortalUserId == 0 || string.IsNullOrWhiteSpace(user.UserId)) { return(UserClass.Unknown); } return(PortalUsersRepository.GetUserClass(user)); }
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)); }