Beispiel #1
0
        internal void ORAccess(int access)
        {
            Permissions newPermissions = new Permissions(access);

            this.View = this.View || newPermissions.View;
            this.Add = this.Add || newPermissions.Add;
            this.Edit = this.Edit || newPermissions.Edit;
            this.Delete = this.Delete || newPermissions.Delete;
            this.Approve = this.Approve || newPermissions.Approve;
        }
Beispiel #2
0
        protected override void OnPreInit(EventArgs e)
        {
            if (ModuleCode != null && ModuleCode.ToLower() == "login")
            {
                this.MasterPageFile = "Views/Shared/Login.Master";
            }
            else
            {
                if (ModuleCode != null && ModuleCode.ToLower().StartsWith("form"))
                    this.MasterPageFile = "Views/Shared/Form.Master";
                else
                    this.MasterPageFile = "Views/Shared/Main.Master";

                CurrentUser = CPLogin.CurrentUser;

                if (CurrentUser == null)
                {
                    CPRedirect("Login.aspx?ReturnPath=" + Server.UrlEncode(Request.RawUrl));
                    return;
                }

                if (ModuleCode != null)
                {
                    ModuleCode = ModuleCode.ToLower();

                    if (ModuleCode.StartsWith("mod") || ModuleCode.StartsWith("sys"))
                    {
                        if (ModuleCode.StartsWith("sys"))
                            UserPermissions = CurrentUser.GetPermissionsByModule("SysAdministrator");
                        else
                            UserPermissions = CurrentUser.GetPermissionsByModule(ModuleCode);
                    }
                    else
                        UserPermissions = new Permissions(31);
                }
                else
                    UserPermissions = new Permissions(31);

                if (UserPermissions == null || ( UserPermissions != null && !UserPermissions.Any))
                {
                    CurrentModule = AccessDeniedModule();
                }
            }
        }