-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create galaxy_ng specific Roles (#1058)
* Update to pulpcore 3.17.3 * Correct verbosity parameter * Add default LOCKED_ROLES * Added roles: galaxy.collection_admin, galaxy.execution_environment_admin * Import adjust_roles from pulpcore plugin api * Integration test to verify expected galaxy locked roles exist * Mark test as standalone_only for time being. Issue: AAH-1092
- Loading branch information
1 parent
f9d0444
commit 3fefab0
Showing
6 changed files
with
113 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
Update to pulpcore 3.17.3 | ||
Create galaxy_ng specific Roles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
from .standalone import STANDALONE_STATEMENTS | ||
from .insights import INSIGHTS_STATEMENTS | ||
from .pulp_container import PULP_CONTAINER_VIEWSETS | ||
from .roles import VIEWSETS | ||
|
||
__all__ = ( | ||
STANDALONE_STATEMENTS, | ||
INSIGHTS_STATEMENTS, | ||
PULP_CONTAINER_VIEWSETS | ||
PULP_CONTAINER_VIEWSETS, | ||
VIEWSETS | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
VIEWSETS = { | ||
"CollectionViewSet": { | ||
"LOCKED_ROLES": { | ||
"galaxy.collection_admin": [ | ||
"galaxy.change_namespace", | ||
"galaxy.delete_namespace", | ||
"galaxy.view_namespace", | ||
"galaxy.upload_to_namespace", | ||
"ansible.delete_collection", | ||
], | ||
} | ||
}, | ||
"ContainerRepositoryViewSet": { | ||
"LOCKED_ROLES": { | ||
"galaxy.execution_environment_admin": [ | ||
"container.delete_containerrepository", | ||
"container.namespace_change_containerdistribution", | ||
"container.namespace_modify_content_containerpushrepository", | ||
"container.namespace_push_containerdistribution", | ||
"container.add_containernamespace", | ||
"container.change_containernamespace", | ||
], | ||
} | ||
}, | ||
"NamespaceViewSet": { | ||
"LOCKED_ROLES": { | ||
"galaxy.namespace_owner": [ | ||
"galaxy.add_namespace", | ||
"galaxy.change_namespace", | ||
"galaxy.delete_namespace", | ||
"galaxy.view_namespace", | ||
"galaxy.upload_to_namespace", | ||
"ansible.delete_collection", | ||
], | ||
"galaxy.publisher": [ | ||
"galaxy.upload_to_namespace", | ||
"ansible.delete_collection", | ||
], | ||
}, | ||
}, | ||
"SyncListViewSet": { | ||
"LOCKED_ROLES": { | ||
"galaxy.synclist_owner": [ | ||
"galaxy.add_synclist", | ||
"galaxy.change_synclist", | ||
"galaxy.delete_synclist", | ||
"galaxy.view_synclist", | ||
], | ||
} | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""test_locked_roles.py - Tests creation of locked roles.""" | ||
|
||
import pytest | ||
|
||
from ..utils import get_client | ||
|
||
pytestmark = pytest.mark.qa # noqa: F821 | ||
|
||
|
||
@pytest.mark.standalone_only | ||
@pytest.mark.role | ||
def test_locked_roles_exist(ansible_config): | ||
galaxy_locked_roles = [ | ||
"galaxy.collection_admin", | ||
"galaxy.execution_environment_admin", | ||
"galaxy.namespace_owner", | ||
"galaxy.publisher", | ||
"galaxy.synclist_owner", | ||
] | ||
|
||
config = ansible_config("ansible_partner") | ||
api_client = get_client( | ||
config=config, | ||
require_auth=True, | ||
request_token=False | ||
) | ||
resp = api_client('/pulp/api/v3/roles/', method='GET') | ||
locked_roles = resp['results'] | ||
|
||
galaxy_locked_roles_count = 0 | ||
for role in locked_roles: | ||
if role["name"].startswith("galaxy.") and role["locked"]: | ||
galaxy_locked_roles_count += 1 | ||
assert role["name"] in galaxy_locked_roles and role["locked"] | ||
assert len(galaxy_locked_roles) == galaxy_locked_roles_count |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters