Skip to content

Commit

Permalink
Add possibility to create users in LDAP mode (#22619)
Browse files Browse the repository at this point in the history
* Add possibility to create users in LDAP mode
  • Loading branch information
dx034 authored Apr 1, 2022
1 parent 29de8da commit 4e4c057
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5318,6 +5318,31 @@ class CustomUserDBModelView(MultiResourceUserMixin, UserDBModelView):
class CustomUserLDAPModelView(MultiResourceUserMixin, UserLDAPModelView):
"""Customize permission names for FAB's builtin UserLDAPModelView."""

_class_permission_name = permissions.RESOURCE_USER

class_permission_name_mapping = {
'userinfoedit': permissions.RESOURCE_MY_PROFILE,
'userinfo': permissions.RESOURCE_MY_PROFILE,
}

method_permission_name = {
'add': 'create',
'userinfo': 'read',
'download': 'read',
'show': 'read',
'list': 'read',
'edit': 'edit',
'userinfoedit': 'edit',
'delete': 'delete',
}

base_permissions = [
permissions.ACTION_CAN_CREATE,
permissions.ACTION_CAN_READ,
permissions.ACTION_CAN_EDIT,
permissions.ACTION_CAN_DELETE,
]


class CustomUserOAuthModelView(MultiResourceUserMixin, UserOAuthModelView):
"""Customize permission names for FAB's builtin UserOAuthModelView."""
Expand Down

0 comments on commit 4e4c057

Please sign in to comment.