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

fix: allow users to reset their passwords #12886

Merged
merged 1 commit into from
Feb 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions superset/security/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class SupersetSecurityManager( # pylint: disable=too-many-public-methods
"metric_access",
}

ACCESSIBLE_PERMS = {"can_userinfo"}
ACCESSIBLE_PERMS = {"can_userinfo", "resetmypassword"}

data_access_permissions = (
"database_access",
Expand Down Expand Up @@ -710,7 +710,7 @@ def set_role(
self.get_session.merge(role)
self.get_session.commit()

def _is_admin_only(self, pvm: Model) -> bool:
def _is_admin_only(self, pvm: PermissionView) -> bool:
"""
Return True if the FAB permission/view is accessible to only Admin users,
False otherwise.
Expand All @@ -731,7 +731,7 @@ def _is_admin_only(self, pvm: Model) -> bool:
or pvm.permission.name in self.ADMIN_ONLY_PERMISSIONS
)

def _is_alpha_only(self, pvm: PermissionModelView) -> bool:
def _is_alpha_only(self, pvm: PermissionView) -> bool:
"""
Return True if the FAB permission/view is accessible to only Alpha users,
False otherwise.
Expand All @@ -750,7 +750,7 @@ def _is_alpha_only(self, pvm: PermissionModelView) -> bool:
or pvm.permission.name in self.ALPHA_ONLY_PERMISSIONS
)

def _is_accessible_to_all(self, pvm: PermissionModelView) -> bool:
def _is_accessible_to_all(self, pvm: PermissionView) -> bool:
"""
Return True if the FAB permission/view is accessible to all, False
otherwise.
Expand All @@ -761,7 +761,7 @@ def _is_accessible_to_all(self, pvm: PermissionModelView) -> bool:

return pvm.permission.name in self.ACCESSIBLE_PERMS

def _is_admin_pvm(self, pvm: PermissionModelView) -> bool:
def _is_admin_pvm(self, pvm: PermissionView) -> bool:
"""
Return True if the FAB permission/view is Admin user related, False
otherwise.
Expand All @@ -772,7 +772,7 @@ def _is_admin_pvm(self, pvm: PermissionModelView) -> bool:

return not self._is_user_defined_permission(pvm)

def _is_alpha_pvm(self, pvm: PermissionModelView) -> bool:
def _is_alpha_pvm(self, pvm: PermissionView) -> bool:
"""
Return True if the FAB permission/view is Alpha user related, False
otherwise.
Expand All @@ -785,7 +785,7 @@ def _is_alpha_pvm(self, pvm: PermissionModelView) -> bool:
self._is_user_defined_permission(pvm) or self._is_admin_only(pvm)
) or self._is_accessible_to_all(pvm)

def _is_gamma_pvm(self, pvm: PermissionModelView) -> bool:
def _is_gamma_pvm(self, pvm: PermissionView) -> bool:
"""
Return True if the FAB permission/view is Gamma user related, False
otherwise.
Expand All @@ -800,7 +800,7 @@ def _is_gamma_pvm(self, pvm: PermissionModelView) -> bool:
or self._is_alpha_only(pvm)
) or self._is_accessible_to_all(pvm)

def _is_sql_lab_pvm(self, pvm: PermissionModelView) -> bool:
def _is_sql_lab_pvm(self, pvm: PermissionView) -> bool:
"""
Return True if the FAB permission/view is SQL Lab related, False
otherwise.
Expand Down Expand Up @@ -828,7 +828,7 @@ def _is_sql_lab_pvm(self, pvm: PermissionModelView) -> bool:
)

def _is_granter_pvm( # pylint: disable=no-self-use
self, pvm: PermissionModelView
self, pvm: PermissionView
) -> bool:
"""
Return True if the user can grant the FAB permission/view, False
Expand Down