Commit Graph

89 Commits

Author SHA1 Message Date
Alan Rominger
622f6ea166 AAP-53980 Disconnect logic to fill in role parents (#15462)
* Disconnect logic to fill in role parents

Get tests passing hopefully

Whatever SonarCloud

* remove role parents/children endpoints and related views

* remove duplicate get_queryset method from RoleTeamsList

---------

Co-authored-by: Peter Braun <pbraun@redhat.com>
2025-10-02 13:06:37 +02:00
Gabriel Muniz
a63067da38 Add instance groups roles (#13584)
* adding roles to instance groups
added ResourceMixin to Instancegroup and changed the filtered_queryset

* added necessary changes to rebuild relationship between IG and roles

* added description to InstanceGroupAccess

* preliminary ui plug for demo purposes

* preliminary ui plug for demo purposes
added inventory special logic for use_role to allow attaching instance groups
added more tests to handle those cases

* Add access_list to InstanceGroup

* scratch branch to test migration work

* refactored to shorten logic

* Added migration and am removing logic that enabled Org admin permissions

* Add Obj admin role to JT, Inv, Org

* Changed tests to reflect new permissions

* refactored some of the tests

* cleaned up more tests and reworded help on InstanceGroupAccess

* Removed unnecessary delete of Route for instance group perms change

* Fix UI tests and migration

* fixed permissions on prompt for InstanceGroups

* added related object roles endpoint

* added ui/api function for options instance_groups

* separate the migrations in order to avoid issues with migrations not being finished

* changed migrations parent class to disable the activity stream error in migrations

* Added logging to migration as activitystream is disabled

* added clarifying comment to jobtemlateaccess and linted UI addition

* renamed migrations to avoid collisions

* Rename migrations to avoid collisions
2023-03-14 21:37:22 -04:00
Alan Rominger
8241ebbc9a Fix migration order of operations bug 2021-04-22 08:36:49 -04:00
Alan Rominger
b40e8d15c0 Fix migration bug
Bump migration number

Skip data migration for fresh migrations
  where ContentType for custom inventory scripts
  has not yet been created
    no scripts will exist in this case, so no-op
2021-04-22 08:36:48 -04:00
Alan Rominger
8440e3f41d Remove ForeignKey relations involving CustomInventoryScript
Add migration to carry out corresponding schema change

Add data migration to delete inventory sources
  which are the custom type

Split migration into two files
  data migration touches same rows as schema migration
2021-04-22 08:36:48 -04:00
Alan Rominger
38352063e8 Remove custom inventory script API 2021-04-22 08:36:46 -04:00
Ryan Petrello
c2ef0a6500 move code linting to a stricter pep8-esque auto-formatting tool, black 2021-03-23 09:39:58 -04:00
AlanCoding
7e6def8acc Grant org JT admin role in migration as well 2020-03-12 15:45:47 -04:00
AlanCoding
7d0b207571 Organization on JT as read-only field
Set JT.organization with value from its project

Remove validation requiring JT.organization

Undo some of the additional org definitions in tests

Revert some tests no longer needed for feature

exclude workflow approvals from unified organization field

revert awxkit changes for providing organization

Roll back additional JT creation permission requirement

Fix up more issues by persisting organization field when project is removed

Restrict project org editing, logging, and testing

Grant removed inventory org admin permissions in migration

Add special validate_unique for job templates
  this deals with enforcing name-organization uniqueness

Add back in special message where config is unknown
  when receiving 403 on job relaunch

Fix logical and performance bugs with data migration

within JT.inventory.organization make-permission-explicit migration

remove nested loops so we do .iterator() on JT queryset

in reverse migration, carefully remove execute role on JT
  held by org admins of inventory organization,
  as well as the execute_role holders

Use current state of Role model in logic, with 1 notable exception
  that is used to filter on ancestors
  the ancestor and descentent relationship in the migration model
    is not reliable
  output of this is saved as an integer list to avoid future
    compatibility errors

make the parents rebuilding logic skip over irrelevant models
  this is the largest performance gain for small resource numbers
2020-03-12 15:45:46 -04:00
AlanCoding
daa9282790 Initial (editable) pass of adding JT.organization
This is the old version of this feature from 2019
  this allows setting the organization in the data sent
  to the API when creating a JT, and exposes the field
  in the UI as well

Subsequent commit changes the field from editable
  to read-only, but as of this commit, the machinery
  is not hooked up to infer it from project
2020-03-12 15:45:46 -04:00
AlanCoding
287159296a remove unused migration methods 2019-07-11 16:09:38 -04:00
AlanCoding
4995ee7a60 remove admin_role for users 2018-04-12 13:18:49 -04:00
Wayne Witzel III
fd9d05d5df fixing deprecated_team.organization credential migration 2016-08-30 14:21:16 -04:00
Wayne Witzel III
dbe3f628d4 ensure team organizations are assigned to credentials 2016-08-25 13:44:55 -04:00
Akita Noek
94052c2b2b Fixed credential migration issue involving null inventory fields in job templates
Don't attempt to derive credential organization information from a job
template when the inventory field is null for that job template

 #3107
2016-07-22 16:44:00 -04:00
Chris Meyers
e5b031e533 use existing logging infrastructure 2016-07-22 12:52:25 -04:00
Chris Meyers
fd098e64dc log migration to standard tower log dir 2016-07-22 09:29:07 -04:00
Akita Noek
de9ae86ecc Fix migration problems with inventoryless job templates
#3067
2016-07-21 10:35:43 -04:00
Akita Noek
353e6100b9 Fix team credential role access in rbac migration 2016-07-14 09:54:41 -04:00
Wayne Witzel III
87ffded774 renaming Credential.owner_role -> Credential.admin_role 2016-06-24 16:55:07 -04:00
Akita Noek
ee8215dc52 Removed InventoryGroup roles 2016-06-23 11:01:22 -04:00
Wayne Witzel III
4799b27108 ensure organization is empty when generating a new credential 2016-06-21 13:07:58 -04:00
Wayne Witzel III
e243c8319d fix tests with refreshes 2016-06-10 13:41:22 -04:00
Wayne Witzel III
5754b4bb2c adjusting Credential model and migrations 2016-06-10 13:23:32 -04:00
Akita Noek
c15db1eef6 Fixed up multi-org project migrations 2016-06-02 13:34:10 -04:00
Akita Noek
19dcc06c9d Read permissions goes to read_role, not use_role
Dork.
2016-05-24 21:10:43 -04:00
Akita Noek
81f093b1c0 Opt to rebuild all roles in helper method
This code was fine for the 0009 migrations since we introduced all roles
at once, however with changes in 0017 we can't just patch from the
roots, so this works generically without having to get fancy about
identifying which roles we need to actually update.
2016-05-24 12:46:43 -04:00
Akita Noek
8aa4df1b78 Fix job template migrations again
Eliminated some incorrect wtf filtering in permissions, and fixed up the
credential access checks.
2016-05-24 12:45:22 -04:00
Akita Noek
5dbce56beb When migrating, grant read_role instead of use_role appropriately
Only give read access to folks that didn't have explicit permissions to
use a project in a job template before.
2016-05-24 12:42:51 -04:00
Akita Noek
fd9c96aa80 Executed the inventory execute_role
Replaced with the 'use_role', which is now useful.

 Completes #1959
2016-05-20 14:10:29 -04:00
Wayne Witzel III
6a6194cc43 update migrations for RBAC 2016-05-13 11:59:12 -04:00
Akita Noek
9d46a39e42 Added comment context to caught exception 2016-05-12 16:31:32 -04:00
Akita Noek
27457239bc Fixed up job template migrations
Massive speed improvement as well as made it not wrong (or at least less wrong).
2016-05-12 13:43:36 -04:00
Akita Noek
be8a1f4859 Another orgfunc migration fix 2016-05-12 13:43:36 -04:00
Akita Noek
83a30f57f5 Fixed JobTemplate migration when inventory is NULL
JobTemplate.inventory can be NULL if the inventory was deleted.
2016-05-03 15:56:02 -04:00
Akita Noek
c7f2568c10 Fixed up some credential migration issues 2016-05-02 14:44:15 -04:00
Akita Noek
58e9c4ef87 Fixed JT migration issue
Role.__contains__ is not defined here, so we needed to drop in the
implementation instead.
2016-05-02 11:14:31 -04:00
Akita Noek
ac1503e55c Fixed org migrations.. users are 'members' not 'auditors' 2016-04-28 11:50:36 -04:00
Akita Noek
27a7cf0d88 Added an explicit save everything step in the rbac migration
This step ensures all of our roles get setup before we start the
migration. It also speeds things up a little as we can wrap everything
with a `with batch_role_ancestor_rebuilding()`. We were pretty much
doing this already, but we had an issue where we didn't catch all job
templates all the time, so this just makes it very explicit and ensures
everything is setup, and does so a little faster.
2016-04-28 10:37:15 -04:00
Akita Noek
c9501ad556 commented out code cleanup 2016-04-28 09:39:18 -04:00
Akita Noek
af4daec314 More RBAC migration fixes 2016-04-27 16:59:33 -04:00
Akita Noek
b670681f6c Handle JT "create" permissions during migration 2016-04-27 15:28:17 -04:00
Akita Noek
280993a15d Dropped stored role name/description and other superflous fields
For name and description, we'll derive these from the role_field and
content type, which is much better for lots of reasons (eg changing text
the future). Also ditched the rest of the fields comming from the
standard common base model, we didn't use them and they cost several
indexes on the table.
2016-04-22 10:16:04 -04:00
Akita Noek
c440aefd85 fix jt tests 2016-04-15 16:08:14 -04:00
Wayne Witzel III
d9538b200a fix User.accessible_objects 2016-04-15 14:57:01 -04:00
Wayne Witzel III
d508254742 updater_role -> update_role 2016-04-15 11:01:35 -04:00
Wayne Witzel III
7098ef8da5 usage_role -> use_role 2016-04-15 11:01:08 -04:00
Wayne Witzel III
5bca1283b2 executor_role -> execute_role 2016-04-15 11:00:33 -04:00
Akita Noek
74d86859f1 Fix project migration when project has exactly one org 2016-04-12 11:40:17 -04:00
Akita Noek
5f8e7bbf55 Replace user.admin_role usage with manual version that works in migrations 2016-04-12 11:40:17 -04:00