Exemplo n.º 1
0
        private void PopulateViewEditAccess(ref List <KeyValuePair <int, KeyValuePair <bool, bool> > > ViewEditColl)
        {
            string StateFIPS = userProfileViewData.StateFIPS;

            foreach (UserRegionalAccessProfile profile in userProfileViewData.RegionalProfiles)
            {
                if (userProfileViewData.IsUserAgencyScope)
                {
                    var CanView = AccessRulesBLL.CanViewAgencyUser(profile.RegionId, profile.IsAdmin, StateFIPS, AdminViewData);
                    var CanEdit = AccessRulesBLL.CanEditAgencyUser(profile.RegionId, profile.IsAdmin, StateFIPS, profile.IsApproverDesignate, AdminViewData);
                    ViewEditColl.Add(new KeyValuePair <int, KeyValuePair <bool, bool> >(profile.RegionId, new KeyValuePair <bool, bool>(CanView, CanEdit)));
                }
                else if (userProfileViewData.IsUserSubStateRegionalScope)
                {
                    var CanView = AccessRulesBLL.CanViewSubStateUser(profile.RegionId, profile.IsAdmin, StateFIPS, AdminViewData);
                    var CanEdit = AccessRulesBLL.CanEditSubStateUser(profile.RegionId, profile.IsAdmin, StateFIPS, profile.IsApproverDesignate, AdminViewData);
                    ViewEditColl.Add(new KeyValuePair <int, KeyValuePair <bool, bool> >(profile.RegionId, new KeyValuePair <bool, bool>(CanView, CanEdit)));
                }
                else if (userProfileViewData.IsUserCMSRegionalScope)
                {
                    var CanView = AccessRulesBLL.CanViewUserProfile(userProfileViewData, AdminViewData);
                    var CanEdit = AccessRulesBLL.CanEditUserProfile(userProfileViewData, AdminViewData);
                    ViewEditColl.Add(new KeyValuePair <int, KeyValuePair <bool, bool> >(profile.RegionId, new KeyValuePair <bool, bool>(CanView, CanEdit)));
                }
            }
        }
Exemplo n.º 2
0
        protected bool IsEditAccessAllowed()
        {
            //While User is visiting his own profile, deny edit, else check for access rights
            if (UserProfileUserId != this.AccountInfo.UserId)
            {
                return(AccessRulesBLL.CanEditUserProfile(userProfileViewData, AdminViewData));
            }

            return(false);
        }
Exemplo n.º 3
0
        protected bool IsEditAccessAllowed(int RegionId)
        {
            bool IsAllowed = false;

            //return AccessRulesBLL.CanEditUserProfile(this.userProfileViewData, UserBLL.GetUser(this.AccountInfo.UserId));
            if (userProfileViewData.IsUserSubStateRegionalScope)
            {
                UserRegionalAccessProfile subStateProfile = userProfileViewData.RegionalProfiles.Where(p => p.RegionId == RegionId).FirstOrDefault();
                if (subStateProfile != null)
                {
                    IsAllowed = AccessRulesBLL.CanEditSubStateUser(subStateProfile.RegionId,
                                                                   subStateProfile.IsAdmin,
                                                                   userProfileViewData.StateFIPS,
                                                                   subStateProfile.IsApproverDesignate,
                                                                   AdminViewData);
                }
            }
            else if (userProfileViewData.IsUserAgencyScope)
            {
                UserRegionalAccessProfile AgencyProfile = userProfileViewData.RegionalProfiles.Where(p => p.RegionId == RegionId).FirstOrDefault();
                if (AgencyProfile != null)
                {
                    IsAllowed = AccessRulesBLL.CanEditAgencyUser(AgencyProfile.RegionId,
                                                                 AgencyProfile.IsAdmin,
                                                                 userProfileViewData.StateFIPS,
                                                                 AgencyProfile.IsApproverDesignate,
                                                                 AdminViewData);
                }
            }
            else if (userProfileViewData.IsUserCMSRegionalScope)
            {
                UserRegionalAccessProfile CMSRegionalProfile = userProfileViewData.RegionalProfiles.Where(p => p.RegionId == RegionId).FirstOrDefault();
                if (CMSRegionalProfile != null)
                {
                    IsAllowed = AccessRulesBLL.CanEditUserProfile(userProfileViewData, AdminViewData);
                }
            }

            return(IsAllowed);
        }
Exemplo n.º 4
0
        private IEnumerable <UserRegionalAccessProfile> GetEditableProfiles()
        {
            List <UserRegionalAccessProfile> editableProfiles = new List <UserRegionalAccessProfile>();

            foreach (UserRegionalAccessProfile profile in UserData.RegionalProfiles)
            {
                if (UserData.Scope.IsEqual(Scope.SubStateRegion))
                {
                    if (AccessRulesBLL.CanEditSubStateUser(profile.RegionId, profile.IsAdmin, UserData.StateFIPS, profile.IsApproverDesignate, AdminViewData))
                    {
                        editableProfiles.Add(profile);
                    }
                }
                else if (UserData.Scope.IsEqual(Scope.Agency))
                {
                    if (AccessRulesBLL.CanEditAgencyUser(profile.RegionId, profile.IsAdmin, UserData.StateFIPS, profile.IsApproverDesignate, AdminViewData))
                    {
                        editableProfiles.Add(profile);
                    }
                }
                else if (UserData.Scope.IsEqual(Scope.CMSRegional))
                {
                    if (AccessRulesBLL.CanEditUserProfile(UserData, AdminViewData))
                    {
                        editableProfiles.Add(profile);
                    }
                }
            }

            if (editableProfiles == null || editableProfiles.Count == 0)
            {
                return(null);
            }
            else
            {
                return(editableProfiles);
            }
        }
Exemplo n.º 5
0
 public bool IsAuthorized()
 {
     //Get ViewData Of Logged In User if User is potential multi regional user[Agency/SubState].
     return(AccessRulesBLL.CanEditUserProfile(UserData, AdminViewData));
 }