Commit Graph
100 Commits
Author SHA1 Message Date
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 1f49b475bd Filter out a users own Admin Role from their roles list
As per a UI request, we don't want to show the implicitly defined
'admin_role' roles that get created for every user so they can manage
themselves. These roles exist for every user, and the only members of
those roles are the users themselves, so it's a pretty boring role. We
also don't want to allow for anyone to be removed from their own admin
role, so hiding this is probably a good thing all around to avoid
confusion and clutter.

 Fixes #1689
2016-05-03 13:52:34 -04:00
Akita Noek 410a9dd45f Special case handlign for team access list to prevent "read" role showing up as a direct team role
Fixes #1713
2016-05-03 13:42:14 -04:00
Akita Noek 18796ec3ff Inventory/Group/Host updating is allowed by those with update_role not just admin_role 2016-05-02 16:38:57 -04:00
Akita Noek e50f20eb69 Check can_update for ProjectAccess.can_start for superusers too
can_update is a special model getter that checks to see if the project
is in a valid state it looks like - so it's important to check this for
superusers too. The can_change check does the implicit is_superuser
check for us, so we don't need another expclit check here, just
can_start protection.
2016-05-02 15:56:05 -04:00
Akita Noek f6f555b185 Prevent organization changes for teams
In old_access.py we restricted even super users from doing this. I'm not
sure that it'd actually break anything to allow this, but I'm making the
new access.py behave like old_access.py for good measure until we have a
valid usecase for this.
2016-05-02 15:49:59 -04:00
Akita Noek 826874d61c CredentialAccess fix to ensure appropriate access to what we're adding a credential to 2016-05-02 15:43:12 -04:00
Akita Noek c7f2568c10 Fixed up some credential migration issues 2016-05-02 14:44:15 -04:00
Akita Noek 5825737447 Reduce JT read access check to simple read_role check 2016-05-02 11:27:37 -04:00
Akita Noek 83e83a5db3 Actually do job template migrations
Seems important
2016-05-02 11:16: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 8a5e22cb4a Fix old_access user/team reference 2016-05-02 10:14:29 -04:00
Akita Noek 29b55fa04d Moved access control from credential add view to access.py
as it should have always been. This messes up being able to post to
api/v1/users/:n/credentials and api/v1/teams/:n/credentials without
specifyign the user/team id in the post body, but looking at the old
code it looks like this might have always been the case, so whatevs..

This fixes a old v new access.py test "failure", and is better anyways..
2016-04-29 17:27:14 -04:00
Akita Noek 1bf4fdbff1 Fixed up the _old_access.py UserAccess queryset 2016-04-29 16:57:51 -04:00
Akita Noek 6427526686 Updated JT migration tests to be more correct
This test was passing before because we were erroneously making all
users organization auditors, which gave users read access to all JT's
under the org.
2016-04-29 15:34:54 -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 951d728472 Fixed and updated activity stream delete operations
Switched to using pre_delete instead of post_delete to record activity
stream delete operations so we have access to all of the fields that may
be associated with the field (eg things that may be being deleted with
this object through a cascade delete).

Switched to recording the full dict of the object instead of a diff
(since the diff will always be empty).
2016-04-28 09:49:26 -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 a6f735b4b9 Fixed call to role rebuilder during migrations 2016-04-27 15:27:52 -04:00
Akita Noek 9921d90316 Fixed duplicate active_roles entries
#1692
2016-04-25 20:33:59 -04:00
Akita Noek 601bd0da05 Fixed up 2.4.5 -> 3.0 no_log merge
Addresses #1295
2016-04-25 15:52:38 -04:00
Akita Noek 3e4c26de13 Added resource information summary fields to the Role serializer
Completes #1676
2016-04-25 15:43:01 -04:00
Akita Noek 3ffefd30a3 flake8 2016-04-25 14:43:03 -04:00
Akita Noek 40147f28f8 Updated test 2016-04-25 14:29:05 -04:00
Akita Noek 30ed9ab740 Reverted cursor pagination for /roles/
Turns out it doesn't play well with our custom filters, and performance
is still tolerable with the normal pagination..
2016-04-25 14:29:05 -04:00
Akita Noek d0e9044dad Enforce team access permissions on team/:n/roles 2016-04-25 14:29:05 -04:00
Akita Noek 4c15374b05 Optimized (user|team)/:n/roles/ 2016-04-25 14:29:05 -04:00
Akita Noek 9df157c971 Added gfk index pair for Role for our access_list queries 2016-04-25 14:29:05 -04:00
Akita Noek 8e4d013342 Optimized /api/v1/hosts/ 2016-04-25 14:29:05 -04:00
Akita Noek 754f8546a6 Switched /api/v1/roles/ to a cursor paginator so we don't have to do a count() on that potentially very large result set 2016-04-25 14:29:05 -04:00
Akita Noek 6250d9f7e7 Optimized RBAC visible_roles query 2016-04-25 14:29:05 -04:00
Akita Noek c18aa44ced Return Queryset instead of Manager fix 2016-04-22 13:48:58 -04:00
Akita Noek 44a8da83c2 Removed all encompassing .distinct() call for all views
This .distinct() call applied .distinct() to all list query sets. Most
query sets are already unique, and adding .distinct causes the database
to do a lot of extra work. Views that rely on this behavior will be
rooted out during the hardening sprint and .distinct() will be added to
the individual querysets as needed instead of applying this everywhere.
2016-04-22 12:30:03 -04:00
Akita Noek b1e140d83d flake8 fixes 2016-04-22 10:17:21 -04:00
Akita Noek 17120ffe4f Futher optimze role rebuilding to be aware of whether we are adding or removing parentage 2016-04-22 10:17:21 -04:00
Akita Noek 569f61ed30 Fixed swapped transaction/rebuild statements 2016-04-22 10:17:21 -04:00
Akita Noek 0c6dcb2337 Optimized our simultaneous role ancestry rebuilding method 2016-04-22 10:17:21 -04:00
Akita Noek ee97ef2fc8 Fix 0008 field addition orderings 2016-04-22 10:17:21 -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 aae548fbdc Regenerated 0008 migration to get rid of Implicit role names/descriptions 2016-04-22 10:16:04 -04:00
Akita Noek 3a2f5d1362 Update BaseSerializer to handle objects that dont have created/modified fields 2016-04-22 10:16:04 -04:00
Akita Noek f57b6da6a5 .gitignore updates 2016-04-20 14:57:35 -04:00
Akita Noek 659d43136f Added missing import 2016-04-20 11:50:20 -04:00
Akita Noek 31920c6700 Removed awx/api/tests dir from Makefile since it no longer exists 2016-04-20 11:48:09 -04:00
Akita Noek 22f18715f7 Removed dup tests, moved old api tests into main/tests/old/api 2016-04-20 11:29:01 -04:00
Akita Noek 568f0e43a5 Skip old slow tests for normal unit test runs, pick them up in nightly runs 2016-04-20 11:27:17 -04:00
Akita Noek a0d25434df Skip old splunk test
This should be removed by #1613
2016-04-20 10:50:54 -04:00
Akita Noek 0434712dc9 Complete the removal of cycle support in RBAC
We removed the actual need for this when we broke the org<->team cycle.
This patch removes the code we had to support that, but since it's
costly and unused, it's now nixxed.
2016-04-19 22:14:38 -04:00
Akita Noek 70148dc2f3 Restored old large inventory test timings
Fixes #1584
2016-04-19 22:14:38 -04:00
Akita Noek f85090110f Fixed up fact tests to work with both sqlite and postgres
Ugly hack for now.. should be cleaned up when we get everything moved
over to postgres
2016-04-19 22:14:38 -04:00
Akita Noek 6864701d8b Revert "Fixed fact cache test difference between sqlite3 and postgres"
This reverts commit 631084b10f4435efe56d3a4fc774dd250f74e2ee.
2016-04-19 22:14:38 -04:00
Akita Noek 127bff5134 Moved role rebuild batching down into sim rebuild code so we can call it directly 2016-04-19 22:14:38 -04:00
Akita Noek 5197c1b65a Optimized implicit role creation for new instances of resources 2016-04-19 22:14:38 -04:00
Akita Noek 233ed894d6 Optimized ImplicitRoleField post_delete action 2016-04-19 22:14:38 -04:00
Akita Noek c0e056d6d0 Fixed fact cache test difference between sqlite3 and postgres
I guess the sqlite adaptation of the JSONField was resulting in a json
encoded blob, where as the postgres version returned something that got
parsed out normally with the rest of the query result?
2016-04-19 22:14:38 -04:00
Akita Noek 6349cc0f85 Skip test_fact.py migrations if MONGO_DB is not confingured 2016-04-19 22:14:38 -04:00
Akita Noek 7ee2c89ab5 test_notifications.py id fix
Ass-ummed an id of 1
2016-04-19 22:14:38 -04:00
Akita Noek 85a1b30af5 Skip activity stream tests if activity stream is disabled 2016-04-19 22:14:38 -04:00
Akita Noek 450e6f2885 Removed git configuration from org count projects
Avoids unnecessary cloning of said git repo, runs in 4 seconds now
instead of 50 seconds
2016-04-19 22:14:38 -04:00
Akita Noek 2a0b445488 Remove git project configuration from project test fixtures
Having this in here causes us to go out and pull down the repo whenever
we run a test, adds around 9 seconds per test on a good connection.. if
we need real data in here, we should figure out how to get it locally
2016-04-19 22:14:38 -04:00
Akita Noek f0aebd00eb Removed transaction=True from pytests
This was overkill and cost 3s per instance, all we needed to do is wrap
things that expectedly fail transactions with transaction.atomic()
2016-04-19 22:14:38 -04:00
Akita Noek ad423e976b Bump splunk time limit up to pass tests, will fix in #1584 2016-04-18 17:58:18 -04:00
Akita Noek 043c71728c Bump our monolithic test time back up.. will try and reduce it post-merge 2016-04-18 17:06:47 -04:00
Akita Noek 41553c39bf Moved dummy data generator out to tools directory 2016-04-18 16:56:29 -04:00
Akita Noek 97f70cdbbc Merge branch 'devel' of github.com:ansible/ansible-tower into 11th-hour 2016-04-18 16:30:55 -04:00
Akita Noek c3144dc4d3 benign 0008 migration change to make makemigrations happy 2016-04-18 16:26:11 -04:00
Akita Noek 07eccbe3e4 Migration for dropping implicit host inventory,name ordering 2016-04-18 16:22:14 -04:00
Akita Noek 96aa3e2555 Attempt 2 at making jenkins' sqlite happy 2016-04-18 15:26:09 -04:00
Akita Noek 0349737538 Attempt at a workaround for our larger sqlite tests
These tests are only failing on jenkins, not on our local dev
environments.
2016-04-18 14:32:21 -04:00
Akita Noek 0cf096e5b0 Updated users.py test expectations to match our current behavior 2016-04-18 14:31:42 -04:00
Akita Noek ceff538969 Merge branch '11th-hour' of github.com:anoek/ansible-tower into 11th-hour 2016-04-18 14:12:44 -04:00
Akita Noek f71c54f882 Merge branch 'devel' of github.com:ansible/ansible-tower into 11th-hour 2016-04-18 11:47:00 -04:00
Akita Noek 878455187f Optimized viewable user list, fixed up some project readability bugs 2016-04-18 11:28:46 -04:00
Akita Noek 8b67f1d1c6 Removed team<->org role cycle 2016-04-18 11:27:22 -04:00
Akita Noek 6d8bab97df Only rebuild ancestor list on post_* events 2016-04-18 08:53:40 -04:00
Akita Noek 2a676d80ce Handle vacuous role rebuilding condition instead of exploding 2016-04-18 08:45:44 -04:00
Akita Noek 85843cc6ad Fixed up some RBAC indexing 2016-04-17 10:20:38 -04:00
Akita Noek a9f2507e91 flake8 2016-04-16 18:54:45 -04:00
Akita Noek 7637b51992 Merge branch 'devel' of github.com:ansible/ansible-tower into 11th-hour 2016-04-16 18:35:25 -04:00
Akita Noek 74caa18cb5 Ditch some expensive prefetching for Hosts
This prefetching gets really expensive when we have a large number of
hosts, it's far less expensive to just go out and do subsequent queries
to pull this data in. (dropped aggregate query time down from ~2400ms to
~180ms)
2016-04-16 18:32:54 -04:00
Akita Noek a7f9eedb21 Be more explicit with our user_admin_role selection to avoid potential future bugs 2016-04-16 18:32:34 -04:00
Akita Noek 849a9c08b0 Drop our implicit order by inventory for Host models
Sorting by inventory (which is really by inventory.name) which is
untenable for a large number of hosts
2016-04-16 18:30:30 -04:00
Akita Noek 850e4c3ace Test fixes and a couple of view optimizations 2016-04-16 18:30:06 -04:00
Akita Noek 5d0c6cc044 Switch to custom ancestry table for some optimized queries
Now we can stuff some more data in this table so we can take advantage
of some multi-column indexing and avoid another to join for our
accessible objects and permissions queries.
2016-04-16 18:27:57 -04:00
Akita Noek 25303cf4ec Reverted user owner_role back to admin_role 2016-04-16 18:24:26 -04:00
Akita Noek 6c50d0793d More test fixes 2016-04-16 10:22:03 -04:00
Akita Noek 2c45f79298 Migration updates for RolePermission removal 2016-04-16 08:47:51 -04:00
Akita Noek 7659da6162 Fixes for old/ad_hoc.py tests 2016-04-16 08:36:36 -04:00
Akita Noek 7bfc8cd43b flake8 2016-04-15 17:22:48 -04:00
Akita Noek 302774e85d Fixed up access_list functionality 2016-04-15 16:47:12 -04:00
Akita Noek 5e7b6ed084 fixes for api/test_credential.py 2016-04-15 16:29:22 -04:00
Akita Noek d5bc455677 admins can use credentials too 2016-04-15 16:27:24 -04:00
Akita Noek 1fa70106d8 Added read_role to credential 2016-04-15 16:26:59 -04:00
Akita Noek 8c8c8a624f Updates to views.py for RolePermission removal 2016-04-15 16:18:17 -04:00
Akita Noek 527be453a4 fix last cred test 2016-04-15 16:11:44 -04:00
Akita Noek c440aefd85 fix jt tests 2016-04-15 16:08:14 -04:00
Akita Noek 926d58b8b7 Merge branch '11th-hour' of github.com:anoek/ansible-tower into 11th-hour 2016-04-15 15:56:10 -04:00