SharePointFBAPack icon indicating copy to clipboard operation
SharePointFBAPack copied to clipboard

Change Password Pages does not work with restricted access

Open HolgerWurbs opened this issue 5 years ago • 2 comments

When you give an FBA user only rights to certain lists, libraries, folders or listitems. SharePoint automatically gives 'Restricted Access' role for the user on Web/Site-Level. The user with such rights will see the "Change Password" menu item but when he clicks it, it will show access denied.

This is because ChangePassword.aspx.cs code is simply subclassed LayoutsPageBase:

public partial class ChangePassword : LayoutsPageBase
{
}

with the default rights being:

public static readonly SPBasePermissions DefaultLayoutsRights = SPBasePermissions.ViewFormPages | SPBasePermissions.Open | SPBasePermissions.ViewPages;

protected virtual SPBasePermissions RightsRequired
{
    get
    {
        return LayoutsPageBase.DefaultLayoutsRights;
    }
}

adding this to the ChangePassword class:

protected override SPBasePermissions RightsRequired
{
    get
    {
        return SPBasePermissions.ViewFormPages | SPBasePermissions.Open;
    }
}

should solve the issue (untested).

HolgerWurbs avatar Jul 07 '20 14:07 HolgerWurbs

Thank you!

ccoulson avatar Jul 13 '20 19:07 ccoulson

Tested it meanwhile, it required another boolean to override and set to false, now it works properly with restricted access rights.

public partial class ChangePassword : LayoutsPageBase
{
    protected override bool RequireDefaultLayoutsRights
    {
        get
        {
            return false;
        }
    }

    protected override SPBasePermissions RightsRequired
    {
        get
        {
            return SPBasePermissions.ViewFormPages | SPBasePermissions.Open;
        }
    }
}

HolgerWurbs avatar Sep 22 '20 09:09 HolgerWurbs