Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Password Pages does not work with restricted access #171

Open
HolgerWurbs opened this issue Jul 7, 2020 · 2 comments
Open

Change Password Pages does not work with restricted access #171

HolgerWurbs opened this issue Jul 7, 2020 · 2 comments

Comments

@HolgerWurbs
Copy link

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).

@ccoulson
Copy link
Member

Thank you!

@HolgerWurbs
Copy link
Author

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;
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants