mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 12:20:45 -03:30
Removed active_roles
The UI isn't using this feature at the moment so we're going to remove it for 3.0, and probably bring it back in 3.1, potentially in different ways depending on UI needs then.
This commit is contained in:
parent
5ed36624a3
commit
5043ff45c2
@ -318,9 +318,6 @@ class BaseSerializer(serializers.ModelSerializer):
|
||||
summary_fields['modified_by'][field] = getattr(obj.modified_by, field)
|
||||
|
||||
# RBAC summary fields
|
||||
request = self.context.get('request', None)
|
||||
if request and isinstance(obj, ResourceMixin) and request.user.is_authenticated():
|
||||
summary_fields['active_roles'] = obj.get_permissions(request.user)
|
||||
roles = {}
|
||||
for field in obj._meta.get_fields():
|
||||
if type(field) is ImplicitRoleField:
|
||||
@ -1524,7 +1521,6 @@ class ResourceAccessListElementSerializer(UserSerializer):
|
||||
|
||||
if 'summary_fields' not in ret:
|
||||
ret['summary_fields'] = {}
|
||||
ret['summary_fields']['active_roles'] = get_roles_on_resource(obj, user)
|
||||
|
||||
def format_role_perm(role):
|
||||
role_dict = { 'id': role.id, 'name': role.name, 'description': role.description}
|
||||
|
||||
@ -416,17 +416,6 @@ def test_ensure_rbac_fields_are_present(organization, get, admin):
|
||||
role = org_role_response.data
|
||||
assert role['related']['organization'] == url
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_ensure_permissions_is_present(organization, get, user):
|
||||
url = reverse('api:organization_detail', args=(organization.id,))
|
||||
response = get(url, user('admin', True))
|
||||
assert response.status_code == 200
|
||||
org = response.data
|
||||
|
||||
assert 'summary_fields' in org
|
||||
assert 'active_roles' in org['summary_fields']
|
||||
assert 'read_role' in org['summary_fields']['active_roles']
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_ensure_role_summary_is_present(organization, get, user):
|
||||
url = reverse('api:organization_detail', args=(organization.id,))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user