Skip to content

Commit

Permalink
use named group in regex
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Feb 23, 2023
1 parent 85c1924 commit 12a7bc0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions superset/security/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@

logger = logging.getLogger(__name__)

DATABASE_PERM_REGEX = re.compile(r"^\[.+\]\.\(id\:(\d+)\)$")
DATABASE_PERM_REGEX = re.compile(r"^\[.+\]\.\(id\:(?P<id>\d+)\)$")


class DatabaseAndSchema(NamedTuple):
Expand Down Expand Up @@ -608,7 +608,7 @@ def get_accessible_databases(self) -> List[int]:
"""
perms = self.user_view_menu_names("database_access")
return [
int(match[1])
int(match.group("id"))
for perm in perms
if (match := DATABASE_PERM_REGEX.match(perm))
]
Expand Down

0 comments on commit 12a7bc0

Please sign in to comment.