예제 #1
0
        public static bool Validate_PageAuth_View(Page myPage, string PageIndexID)
        {
            Pages.PrivacyMgr myPrivacyMgr = new Pages.PrivacyMgr();

            string _pageindexid = myPrivacyMgr.Get_Inherited_Privacy_PageIndexID(PageIndexID);

            // Check Guest User first
            Pages.Page_Privacy Guest_Privacy = myPrivacyMgr.Get_Page_Privacy(_pageindexid, StringEnum.GetStringValue(UserGroup.Guest));

            if (Guest_Privacy == null)
            {
                // If Guest permission didn't set permission is allowed.
                return(true);
            }
            else
            {
                if (Guest_Privacy.Allow_View)
                {
                    return(true);
                }
            }

            // Check logged in user.
            UserMgr     myUserMgr = new UserMgr();
            Login_Users myUsers   = myUserMgr.Get_Login_Users(myPage);

            if (myUsers != null)
            {
                // User has logged in
                List <UserInGroups> myUserInGroups = myUserMgr.Get_UserIngroups_ByUserID(myUsers.UserID);

                foreach (UserInGroups myUserInGroup in myUserInGroups)
                {
                    Pages.Page_Privacy myPage_Privacy = myPrivacyMgr.Get_Page_Privacy(_pageindexid, myUserInGroup.UserGroupID);

                    if (myPage_Privacy != null)
                    {
                        if (myPage_Privacy.Allow_View)
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
예제 #2
0
        public static bool Validate_PageAuth_Modify(Page myPage)
        {
            Pages.PrivacyMgr myPrivacyMgr = new Pages.PrivacyMgr();

            string _pageindexid = myPrivacyMgr.Get_Inherited_Privacy_PageIndexID(myPage.Request["PageIndexID"]);

            // Check Guest User first
            Pages.Page_Privacy Guest_Privacy = myPrivacyMgr.Get_Page_Privacy(_pageindexid, StringEnum.GetStringValue(UserGroup.Guest));

            if (Guest_Privacy != null)
            {
                if (Guest_Privacy.Allow_Modify)
                {
                    return(true);
                }
            }

            // Check logged in user.
            UserMgr     myUserMgr = new UserMgr();
            Login_Users myUsers   = myUserMgr.Get_Login_Users(myPage);

            if (myUsers != null)
            {
                // User has logged in
                List <UserInGroups> myUserInGroups = myUserMgr.Get_UserIngroups_ByUserID(myUsers.UserID);

                foreach (UserInGroups myUserInGroup in myUserInGroups)
                {
                    Pages.Page_Privacy myPage_Privacy = myPrivacyMgr.Get_Page_Privacy(_pageindexid, myUserInGroup.UserGroupID);

                    if (myPage_Privacy != null)
                    {
                        if (myPage_Privacy.Allow_Modify)
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }