Commit Graph

162 Commits

Author SHA1 Message Date
beeankha
9024a514a6 Add API endpoints for workflow approvals 2019-08-27 15:30:39 -04:00
Jim Ladd
8158632344 render notification templates 2019-08-25 23:11:24 -07:00
Ryan Petrello
a47a2d8567 properly set is_system_auditor on initial LDAP login
django-auth-ldap recently changed its behavior at login to *delay* the
user.save() call:

b777321fb4

our current process of discovering and setting up the system auditor
role at LDAP login *relies* on the user having a primary key, so this
code now manually calls .save() to enforce one
2019-07-30 10:05:39 -04:00
Jeff Bradberry
2d81923e22 Fix up changes in fields in the migrations
Particularly the now-required on_delete parameter for ForeignKey and
OneToOneField.
2019-07-12 15:11:22 -04:00
Jeff Bradberry
bcbb768dd3 Remove the use of the deprecated Field.rel attribute
Also, rename a number of variables named `rel` for ease of searching.
2019-07-12 15:11:21 -04:00
Ryan Petrello
6da445f7c0 remove /api/v1 and deprecated credential fields 2019-06-06 12:23:00 -04:00
AlanCoding
fedd1cf22f Replace JobOrigin with ActivityStream.action_node 2019-05-31 07:10:07 -04:00
AlanCoding
9c71204435 show activity stream entry for system auditor association 2019-04-16 15:59:04 -04:00
chris meyers
0c6a522813 remove system tracking
* Leave the artisanal handcrafted migration from vendored fact scan to
external fact gathering.
2019-04-12 14:30:29 -04:00
Jake McDermott
c209955400 add credential plugin system and minimal working hashivault 2019-04-02 11:19:26 -04:00
Kia Lam
d2c345a374 Fix API lint error. 2019-02-22 13:06:20 -05:00
Ryan Petrello
43ca4526b1 define native CredentialType inputs/injectors in code, not in the DB
This has a few benefits:

1.  It makes adding new fields to built-in CredentialTypes _much_
    simpler.  In the past, we've had to write a migration every time we
    want to modify an existing type (changing a label/help text,
    changing options like the recent become_method changes) or
    when adding a new field entirely

2.  It paves the way for third party credential plugins support, where
    importable libraries will define their own source code-based schema
2019-02-19 10:22:26 -05:00
Ryan Petrello
9bebf3217e remove usage of import * and enforce F405 in our linter
import * is a scourge upon the earth
2019-02-13 17:10:33 -05:00
Ryan Petrello
f223df303f convert py2 -> py3 2019-01-15 14:09:01 -05:00
AlanCoding
d2cd337c1f fix links to some resources that lack v1 pages 2018-12-06 08:29:23 -05:00
Ryan Petrello
db1a669c68 work around a django-polymorphic bug that breaks certain cascades
see: #1794
2018-05-15 16:55:37 -04:00
adamscmRH
4197a9fd35 granularly prevent filtering oauth secrets 2018-04-30 11:54:23 -04:00
AlanCoding
4995ee7a60 remove admin_role for users 2018-04-12 13:18:49 -04:00
adamscmRH
fa7647f828 fix token creation 2018-03-01 16:19:58 -05:00
adamscmRH
310f37dd37 clears authtoken & add PAT 2018-02-22 15:18:12 -05:00
Aaron Tan
1c2621cd60 Implement session-based and OAuth 2 authentications
Relates #21. Please see acceptance docs for feature details.

Signed-off-by: Aaron Tan <jangsutsr@gmail.com>
2018-02-22 15:18:12 -05:00
Ryan Petrello
fc94b3a943 generalize stdout event processing to emit events for *all* job types
* introduces three new models: `ProjectUpdateEvent`,
  `InventoryUpdateEvent`, and `SystemJobEvent`
* simplifies the stdout callback management in `tasks.py` - now _all_
  job run types capture and emit events to the callback receiver
* supports stdout reconstruction from events for stdout downloads for
  _all_ job types
* configures `ProjectUpdate` runs to configure the awx display callback
  (so we can capture real playbook events for `project_update.yml`)
* ProjectUpdate, InventoryUpdate, and SystemJob runs no longer write
  text blobs to the deprecated `main_unifiedjob.result_stdout_text` column

see: https://github.com/ansible/awx/issues/200
2018-01-03 09:09:42 -05:00
Ryan Petrello
202161f090 move legacy UnifiedJob stdout data to a separate unmanaged model
This data often (in the case of inventory updates) represents large data
blobs (5+MB per job run).  Storing it on the polymorphic base class
table, `main_unifiedjob`, causes it to be automatically fetched on every
query (and every polymorphic join) against that table, which can result
in _very_ poor performance for awx across the board.  Django offers
`defer()`, but it's quite complicated to sprinkle this everywhere (and
easy to get wrong/introduce side effects related to our RBAC and usage
of polymorphism).

This change moves the field definition to a separate unmanaged model
(which references the same underlying `main_unifiedjob` table) and adds
a proxy for fetching the data as needed

see https://github.com/ansible/awx/issues/200
2017-12-12 18:16:19 -05:00
Ryan Petrello
68b924efe5 flake8 fixup 2017-09-18 09:44:39 -04:00
Ryan Petrello
7a958a1af1 more result_stdout_text defer optimization for inventory updates
see: https://github.com/ansible/ansible-tower/issues/7568
2017-09-15 09:51:53 -04:00
Ryan Petrello
1bb6c17fe2 trick django-polymorphic into allowing defer() on polymorphic objects
django-polymorphic itself generates queries for polymorphic object
lookups, and these queries for UnifiedJob are *not* properly defering the
`result_stdout_text` column, resulting in more very slow queries.  This
solution is _very_ hacky, and very specific to this specific
version of Django and django-polymorphic, but it works until we can
solve this problem the proper way in 3.3 (by removing large stdout blobs
from the database).

see: https://github.com/ansible/ansible-tower/issues/7568
2017-09-15 09:51:43 -04:00
Aaron Tan
70cccb0e57 Expand scope of enterprise user types. 2017-06-20 12:17:13 -04:00
AlanCoding
3243110496 connect CredentialType to activity stream 2017-05-03 13:53:11 -04:00
Wayne Witzel III
11eb99820d Initial pass of removing RBAC deprecated fields and Permission 2017-05-02 22:38:34 -04:00
Ryan Petrello
d24fb32358 blacklist certain sensitive fields and relations as search arguments
see: #5465
see: #5478
2017-02-21 16:18:02 -05:00
AlanCoding
0dbd9e4839 get WFJT nodes in activity stream 2017-01-27 14:10:28 -05:00
AlanCoding
1daeff8db1 unsaved user system auditor status made more conservative 2016-12-05 17:01:50 -05:00
AlanCoding
8c64fa2fe1 handle is_system_auditor case with unsaved users 2016-12-05 12:13:28 -05:00
AlanCoding
14746eebe3 fix system auditor getter logic 2016-12-05 11:22:11 -05:00
AlanCoding
14ce50c845 implement copying of WFJT objects 2016-11-22 11:35:01 -05:00
Alan Rominger
266d29936d Merge pull request #3985 from AlanCoding/auditor_optimization
System auditor optimization via cache
2016-11-22 11:19:23 -05:00
Aaron Tan
1c36462b1b Hook up activity stream with workflow. 2016-11-21 16:55:34 -05:00
AlanCoding
fc72aafeb8 introduce caching for is_system_auditor method 2016-11-19 11:54:06 -05:00
Aaron Tan
9e4655419e Fix flake8 E302 errors. 2016-11-15 20:59:39 -05:00
Aaron Tan
4ee7d1a136 Catch the missing piece. 2016-11-15 16:50:23 -05:00
Aaron Tan
473ed016de Fix flake8 E305 errors. 2016-11-15 16:32:27 -05:00
Wayne Witzel III
39f337d933 added model for holding channel group information, updating asgi_amsqp req 2016-10-06 16:16:27 -04:00
Chris Church
6ebe45b1bd Configure Tower in Tower:
* Add separate Django app for configuration: awx.conf.
* Migrate from existing main.TowerSettings model to conf.Setting.
* Add settings wrapper to allow get/set/del via django.conf.settings.
* Update existing references to tower_settings to use django.conf.settings.
* Add a settings registry to allow for each Django app to register configurable settings.
* Support setting validation and conversion using Django REST Framework fields.
* Add /api/v1/settings/ to display a list of setting categories.
* Add /api/v1/settings/<slug>/ to display all settings in a category as a single object.
* Allow PUT/PATCH to update setting singleton, DELETE to reset to defaults.
* Add "all" category to display all settings across categories.
* Add "changed" category to display only settings configured in the database.
* Support per-user settings via "user" category (/api/v1/settings/user/).
* Support defaults for user settings via "user-defaults" category (/api/v1/settings/user-defaults/).
* Update serializer metadata to support category, category_slug and placeholder on OPTIONS responses.
* Update serializer metadata to handle child fields of a list/dict.
* Hide raw data form in browsable API for OPTIONS and DELETE.
* Combine existing licensing code into single "TaskEnhancer" class.
* Move license helper functions from awx.api.license into awx.conf.license.
* Update /api/v1/config/ to read/verify/update license using TaskEnhancer and settings wrapper.
* Add support for caching settings accessed via settings wrapper.
* Invalidate cached settings when Setting model changes or is deleted.
* Preload all database settings into cache on first access via settings wrapper.
* Add support for read-only settings than can update their value depending on other settings.
* Use setting_changed signal whenever a setting changes.
* Register configurable authentication, jobs, system and ui settings.
* Register configurable LDAP, RADIUS and social auth settings.
* Add custom fields and validators for URL, LDAP, RADIUS and social auth settings.
* Rewrite existing validator for Credential ssh_private_key to support validating private keys, certs or combinations of both.
* Get all unit/functional tests working with above changes.
* Add "migrate_to_database_settings" command to determine settings to be migrated into the database and comment them out when set in Python settings files.
* Add support for migrating license key from file to database.
* Remove database-configuable settings from local_settings.py example files.
* Update setup role to no longer install files for database-configurable settings.

f 94ff6ee More settings work.
f af4c4e0 Even more db settings stuff.
f 96ea9c0 More settings, attempt at singleton serializer for settings.
f 937c760 More work on singleton/category views in API, add code to comment out settings in Python files, work on command to migrate settings to database.
f 425b0d3 Minor fixes for sprint demo.
f ea402a4 Add support for read-only settings, cleanup license engine, get license support working with DB settings.
f ec289e4 Rename migration, minor fixmes, update setup role.
f 603640b Rewrite key/cert validator, finish adding social auth fields, hook up signals for setting_changed, use None to imply a setting is not set.
f 67d1b5a Get functional/unit tests passing.
f 2919b62 Flake8 fixes.
f e62f421 Add redbaron to requirements, get file to database migration working (except for license).
f c564508 Add support for migrating license file.
f 982f767 Add support for regex in social map fields.
2016-09-26 22:14:47 -04:00
Chris Meyers
4c876b40e4 initial models and endpoints added for workflows 2016-08-30 15:05:28 -04:00
Akita Noek
a42986894f Made it so org auditors can see all users if ORG_ADMINS_CAN_SEE_ALL_USERS is true
Addresses #2706
2016-07-07 09:22:36 -04:00
Akita Noek
390ac656fa Bolted is_system_auditor faux-field onto User 2016-05-18 16:02:10 -04:00
Matthew Jones
5895b3a343 Refactor Notification's naming
Notifier -> NotificationTemplate
notifier -> notification_template
2016-05-05 13:53:46 -04:00
Akita Noek
7bfc8cd43b flake8 2016-04-15 17:22:48 -04:00
Wayne Witzel III
eae7349665 update access calls to new RBAC roles 2016-04-15 10:45:33 -04:00
Akita Noek
8887db231b Progress on ripping out RolePermissions 2016-04-14 09:44:20 -04:00