Commit Graph
100 Commits
Author SHA1 Message Date
Akita Noek 3c8c72adf9 JSHint fix: unused variable 2016-06-01 09:03:06 -04:00
Akita Noek 8c5086a5e7 Merge branch 'release_3.0.0' of github.com:ansible/ansible-tower into 858 2016-06-01 09:00:09 -04:00
Akita Noek d971461ae6 Commented out code cleanup 2016-05-31 17:15:14 -04:00
Akita Noek d8dac662a1 Fixed/enhanced scan job type selection process
* Appropriately set project and playbook to default when job type is set
  to 'scan' - #1273
* Add 'RESET' link on the Project label line to reset to Default
  project/playbook #858
* Fixed dropdown option clearing problem #1489
* Remember what project/playbook was set when switching from run/check
  to scan, so if you change back, those options will be auto-selected
  again
2016-05-31 16:03:01 -04:00
Akita Noek 22300347f0 JSHint fixes 2016-05-27 14:39:08 -04:00
Akita Noek e3fcdf9ba8 Unobfuscated some decorators 2016-05-27 14:18:05 -04:00
Akita Noek f6da30dde3 Avoid unnecessary license checks 2016-05-27 09:32:29 -04:00
Akita Noek eedd48c82b == to === 2016-05-26 20:58:08 -04:00
Akita Noek 6b3638c0bb Show stdout download button for canceled jobs
Addresses #733
2016-05-26 16:35:26 -04:00
Akita Noek c5dfde236b Test "fix"
Having this triggers a license feature test, which the jenkins test
system apparently doesn't have.. I don't think it's particularly
important to test this particular field, so meh.
2016-05-26 15:18:23 -04:00
Akita Noek e531bc67e4 Better control what JT admins are allowed to do
This addresses #1981 which says that JT admins can make modifications to
a job template freely if they're just changing non functional things
like name, description, forks, verbosity, etc, while requiring them to
have access to all functional components if they're going to make any
changes to the functionality - in specific, any changes to the
inventory, project, playbook, or credentials requires that the user have
the appropriate use access on all of those things in order to make the
change.
2016-05-26 14:39:16 -04:00
Akita Noek fed8d49d86 Added optional "expect" arg for REST fixtures" 2016-05-26 13:58:26 -04:00
Akita Noek aca858f5b2 Ported some old adhoc tests over to the new system 2016-05-26 13:58:16 -04:00
Akita Noek 5ea372ae43 Updated Job.limit expectation in old tests
See 821c43ba88d18feaded696e9994a9c5277a3195b
2016-05-26 13:58:08 -04:00
Akita Noek aa49e071c6 Disabling RAX test until we get our cert issue figured out
Related to #1706
2016-05-26 13:57:55 -04:00
Akita Noek 1abba522b0 Resurrect global .distinct() call (mostly)
This mostly reverts 3c67971e78a12bd94536aa5464f0bc1ea46ba1ee with
the minor difference that we only apply this when we're filtering,
which is apparently necessary without some notable overhaul since
the filtering we're doing will get stuck in as filters, which will
generate inner joins, which can result in duplicates if the thing
we're joining with is a one to many or many to many, which most
things are.

With this patch we still need to be generating naturally distinct
querysets with any `get_queryset` methods, which will still be much
more effecient when filtering is not involved.

This fixes #2032 and probably a bunch of other undiscovered issues.
2016-05-24 22:19:51 -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 899ff8ed3b flake8 2016-05-24 13:19:55 -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 5eb67411a4 Rebuild role hierarchy after making changes in migrations
Signals don't fire in migrations, so gotta do this step manually
2016-05-24 12:38:25 -04:00
Akita Noek a5bc62d7d4 enforce use_role access on both inventory and project when adding a JT 2016-05-24 12:37:44 -04:00
Akita Noek 4e9e341819 Disable custom inventory script input when you have no access
Also show 'Script contents hidden'

 #1503
2016-05-20 14:53:36 -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
Akita Noek 10cb04ae80 Fix access list to return complete team role list
We were just returning the first element before, dur.

 Fixes #1932
2016-05-19 16:37:06 -04:00
Akita Noek 741c6a0cfd Text update for team role removal confirmation message
#1919
2016-05-19 14:46:35 -04:00
Akita Noek 1d8f69c156 Split permissions list into two columns
One for user perms and one for team permissions

 #1986
2016-05-19 14:32:13 -04:00
Akita Noek 49b88dd646 Hide the user type selection for non super users
Completes UI portion of #1974
2016-05-19 13:34:51 -04:00
Akita Noek 23e7e12a04 Support creating system auditors through all 4 of our user creation endpoints 2016-05-19 13:07:58 -04:00
Akita Noek e6322baf20 Show selected playbook in JT's even if you can't read the project
#1955
2016-05-19 12:08:46 -04:00
Akita Noek 01a2590271 Don't allow text selection on checkbox labels nor buttons
Prevents annoying random text selection when you're clicking through
things.
2016-05-19 11:02:43 -04:00
Akita Noek aa9a4925b0 Fix annoying warning message related to license info not loading appropriately
Log it into the console though.

This shouldn't be necessary after #1763 lands, but isn't a bad thing to
be doing in general.
2016-05-19 10:03:42 -04:00
Akita Noek 9fba513c4f Protect against bad posts, fixes some test cases 2016-05-18 17:01:38 -04:00
Akita Noek 49a2f6b535 Default is_system_auditor to False in serializer for API compatibility 2016-05-18 16:50:52 -04:00
Akita Noek 9e562deb0c Copy paste error 2016-05-18 16:50:43 -04:00
Akita Noek 58f142e2e6 Update user add/edit UI to support System Auditor setting
Also moved the LDAP indicator to be inline with the mockups (bubble next
to the uesrname in the upper left)

 #1937
 #1888
2016-05-18 16:08:36 -04:00
Akita Noek d79d8cbfba Don't let Org Admins promote themselves to System Admins
Nor System Auditor
2016-05-18 16:03:36 -04:00
Akita Noek 390ac656fa Bolted is_system_auditor faux-field onto User 2016-05-18 16:02:10 -04:00
Akita Noek 70f561c895 Make tab skip over 'SHOW' buttons next to sensitive / password prompts 2016-05-18 13:53:21 -04:00
Akita Noek e9ea791a85 Brand that cow! 2016-05-17 11:47:49 -04:00
Akita Noek 9026d02be2 Fixed our beloved cow 2016-05-17 11:06:58 -04:00
Akita Noek 802a112106 Fixed project update permissions
Now folks in the update role can update a project as intended, yay!

 #1929
2016-05-17 09:01:17 -04:00
Akita Noek 98412b52f2 Handle non-existent license data in config view 2016-05-16 16:34:01 -04:00
Akita Noek 2c652a7375 Typo 2016-05-16 16:14:53 -04:00
Akita Noek a828e8b005 Implemented team role removal
Also threw in the little fa-users icon when it's a permission coming from a team

 #1919
2016-05-16 15:21:04 -04:00
Akita Noek 06eb13a104 Fixed duplicate users in access_list
Uhg.
2016-05-16 10:52:41 -04:00
Akita Noek ac5bc2aaba Fixed duplicate entries in active_roles (again)
#1692
2016-05-16 10:49:34 -04:00
Akita Noek a2cc2927e6 Turn off activity stream flag in the UI if we have it explicitly disabled in our settings file 2016-05-16 10:38:22 -04:00
Akita Noek 01e01fdb82 Hide AS/Dashboard button for basic licenses
#1791
2016-05-16 10:28:40 -04:00
Akita Noek 60f76de5c3 RBAC doc updates 2016-05-13 12:01:54 -04:00
Akita Noek 6958e81d00 Filled in RBAC descriptions
#1655
2016-05-13 10:11:38 -04:00
Akita Noek 9d46a39e42 Added comment context to caught exception 2016-05-12 16:31:32 -04:00
Akita Noek acc49bbbef Fixed up JT migration tests 2016-05-12 13:46:13 -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 4378430c4f Minor migration speed improvement for old access queries 2016-05-12 13:43:36 -04:00
Akita Noek 6c0c789612 Make job queryset only require JT read access to see
As opposed to credential access, since users can see and potentially run
JT's without credential access now.
2016-05-12 13:43:36 -04:00
Akita Noek fb97438573 Enforce jt admin_role requirement for changing/deleting JobTemplates 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 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