Esempio n. 1
0
        public IActionResult ResetPassword([FromBody] ProfileView profileView)
        {
            var profile = profileView.ToProfile();

            BusinessFacade.GetBSO <ProfileBSO>().ResetPassword(profile);
            return(new ObjectResult(null));
        }
Esempio n. 2
0
        public virtual Profile CreateProfile(Profile profile)
        {
            //role validation
            if (profile.ProfileRole.Where <ProfileRole>(r => r.RoleItemId == EntityConstants.ROLE_IDS_NORMALUSER).Count() > 0)
            {
                profile.Status = EntityConstants.PROFILE_STATUS_ACTIVE;
            }
            else
            {
                throw new Exception("unsupported profile role");
            }


            lock (this)
            {
                CheckProfileExistance(profile);

                //default party creation
                var party = BusinessFacade.GetBSO <PartyBSO>().CreatePersonParty();

                //profile
                profile.PartyId = party.PartyId;
                var profileRoles = profile.ProfileRole;
                profile = CreateProfileSlim(profile);

                //profileRoles
                profile.ProfileRole = profileRoles;
                this.partyRoleBSO.UpdateProfileRoles(profile);

                return(profile);
            }
        }
Esempio n. 3
0
        public ProfileView CreateProfile([FromBody] ProfileView profileView)
        {
            Profile p = profileView.ToProfile();

            p = BusinessFacade.GetBSO <ProfileBSO>().CreateNormalProfile(p);
            return(p.ToProfileView());
        }
Esempio n. 4
0
        public IActionResult DeleteProfile()
        {
            int profileId = this.GetCurrentUserId();

            BusinessFacade.GetBSO <ProfileBSO>().DeactivateProfile(profileId);
            return(new ObjectResult(null));
        }
Esempio n. 5
0
        public ProfileView UpdateProfileMine([FromBody] ProfileView profileView)
        {
            Profile p = profileView.ToProfile();

            p.ProfileId = this.GetCurrentUserId();
            p           = BusinessFacade.GetBSO <ProfileBSO>().UpdateProfile(p);
            return(p.ToProfileView());
        }
Esempio n. 6
0
 public ProfileBSO()
 {
     this.profileRepo   = FacadeProvider.IfsFacade.GetRepositoryByInterface <IProfileRepository>();
     this.logger        = FacadeProvider.IfsFacade.GetLogger <ProfileBSO>();
     this.idMapBSO      = BusinessFacade.GetBSO <IDMapBSO>();
     this.partyRoleBSO  = BusinessFacade.GetBSO <RoleBSO>();
     this.configuration = FacadeProvider.IfsFacade.GetConfigurationRoot();
     this.services      = FacadeProvider.IfsFacade.GetExternalServices();
 }
Esempio n. 7
0
        public virtual Profile GetProfile(Profile profile)
        {
            profile = GetProfileSlim(profile);

            if (profile != null)
            {
                profile.Party = BusinessFacade.GetBSO <PartyBSO>().GetParty(profile.PartyId);
            }
            return(profile);
        }
Esempio n. 8
0
        public IActionResult GetProfile()
        {
            int profileId = this.GetCurrentUserId();
            var p         = BusinessFacade.GetBSO <ProfileBSO>().GetProfile(new Profile()
            {
                ProfileId = profileId
            });
            var profileView = p.ToProfileView();

            return(new ObjectResult(profileView));
        }
Esempio n. 9
0
        public DataListView <ProfileListingView> GetProfiles([FromBody] ProfileFilterView filter)
        {
            var list       = BusinessFacade.GetBSO <ProfileBSO>().GetProfiles(filter, filter.Page, filter.PageSize);
            var totalCount = BusinessFacade.GetBSO <ProfileBSO>().GetProfilesTotalCount(filter);
            var result     = new DataListView <ProfileListingView>()
            {
                DataList   = GetProfileListingView(list),
                TotalCount = totalCount
            };

            return(result);
        }
Esempio n. 10
0
        public virtual Profile UpdateProfile(Profile profile)
        {
            //updating profile itself not permited; just fetching existing one and filling missing data
            var p = GetProfileSlim(profile);

            profile.Party.PartyId = p.PartyId;

            //updating party
            BusinessFacade.GetBSO <PartyBSO>().UpdateParty(profile.Party);

            return(GetProfile(profile));
        }
Esempio n. 11
0
        public Task ValidateAsync(ResourceOwnerPasswordValidationContext context)
        {
            var profile = BusinessFacade.GetBSO <ProfileBSO>().GetProfileSlim(new Common.Entities.Profile()
            {
                UserId = context.UserName
            });

            if (profile != null && profile.Password.Equals(context.Password.HashPassword()))
            {
                context.Result =
                    new GrantValidationResult(profile.ProfileId.ToString(), OidcConstants.AuthenticationMethods.Password);
            }
            return(Task.FromResult(0));
        }
Esempio n. 12
0
        public Task IsActiveAsync(IsActiveContext context)
        {
            string subjectId = context.Subject.GetSubjectId();

            if (!subjectId.IsNullOrEmpty())
            {
                var profileId = int.Parse(subjectId);
                var profile   = BusinessFacade.GetBSO <ProfileBSO>().GetProfileSlim(new Common.Entities.Profile()
                {
                    ProfileId = profileId
                });
                context.IsActive = profile != null;
            }
            else
            {
                context.IsActive = false;
            }
            return(Task.FromResult(0));
        }
Esempio n. 13
0
        public Task GetProfileDataAsync(ProfileDataRequestContext context)
        {
            string subjectId = context.Subject.GetSubjectId();
            var    profileId = int.Parse(subjectId);
            var    profile   = BusinessFacade.GetBSO <ProfileBSO>().GetProfileSlim(new Common.Entities.Profile()
            {
                ProfileId = profileId
            });

            var claims = new List <Claim>()
            {
                new Claim(JwtClaimTypes.Subject, profile.ProfileId.ToString()),
                new Claim(JwtClaimTypes.Id, profile.UserId)
            };

            if (!String.IsNullOrEmpty(profile.UserId))
            {
                claims.Add(new Claim(JwtClaimTypes.Name, profile.UserId));
                claims.Add(new Claim(JwtClaimTypes.FamilyName, profile.UserId));
            }

            context.IssuedClaims = claims;
            return(Task.FromResult(0));
        }
Esempio n. 14
0
 public PartyBSO()
 {
     this.partyRepo = FacadeProvider.IfsFacade.GetRepository <Party>();
     this.logger    = FacadeProvider.IfsFacade.GetLogger <PartyBSO>();
     this.idMapBSO  = BusinessFacade.GetBSO <IDMapBSO>();
 }
Esempio n. 15
0
 public ProfilesController()
 {
     this.partyRoleBSO     = BusinessFacade.GetBSO <RoleBSO>();
     this.externalServices = FacadeProvider.IfsFacade.GetExternalServices();
     this.configuration    = FacadeProvider.IfsFacade.GetConfigurationRoot();
 }
 public RoleResourceRequirementHandler() : base()
 {
     this.logger        = FacadeProvider.IfsFacade.GetLogger <RoleResourceRequirementHandler>();
     this.partyRoleBSO  = BusinessFacade.GetBSO <RoleBSO>();
     this.configuration = FacadeProvider.IfsFacade.GetConfigurationRoot();
 }
Esempio n. 17
0
 public IActionResult ChangeMyPassword([FromBody] ChangePasswordView cpv)
 {
     BusinessFacade.GetBSO <ProfileBSO>().ChangePassword(this.GetCurrentUserId(), cpv.OldPassword, cpv.NewPassword);
     return(new ObjectResult(null));
 }