Commit Graph

119 Commits

Author SHA1 Message Date
Chris Meyers
80e89b1116 spelling is hard 2017-04-03 15:53:54 -04:00
Chris Meyers
6cbdb8d0e6 faster first time parse generator
* Generating the set of valid unicode characters is expensive in terms
of memory storage. Instead, we define the grammer by the negation of
allowed unicode characters. Much faster.
2017-04-03 15:32:21 -04:00
Chris Meyers
a8213661fd basic fact search grammar
* Establish a base grammar for handling json path specification and
value matching. With boolean logic support and parenthesis grouping
i.e. (a.b.c="value") and ((a.b="foo") or (a="bar"))
* generate Q() results for passing to Host.objects.filter()
* Hooked up via /api/v1/hosts?host_filter=...
* DynamicFilterField added to store host filter as string with grammar
parser attached as static methods for later use by DynamicInventory &
continued use by host_filter=...
2017-04-03 15:32:21 -04:00
AlanCoding
49faf212ef consolidate RBAC is_implicit_parent code 2017-03-24 09:25:24 -04:00
AlanCoding
169384ddbe Start RBAC unit testing system to test is_implicit_parent 2017-03-23 15:57:50 -04:00
AlanCoding
bb292f817b move check for implicit parent role into fields.py 2017-03-22 16:30:15 -04:00
Alan Rominger
a192077be4 Merge pull request #4025 from AlanCoding/text_type
Change JSONField to be a DB text type
2016-11-18 11:50:13 -05:00
Aaron Tan
9e4655419e Fix flake8 E302 errors. 2016-11-15 20:59:39 -05:00
AlanCoding
a1f2f64a09 change JSONField to be a DB text type 2016-11-15 13:57:10 -05:00
Chris Church
3eb6f55a80 Default JSONField to empty dict if field does not allow None. 2016-11-15 10:21:34 -05:00
Chris Church
8dc5e7725c Fix configure Tower in Tower to work with updated django-jsonfield. 2016-11-15 00:22:55 -05:00
AlanCoding
339661a6a5 New method to monkeypatch JSONField 2016-11-14 16:35:56 -05:00
Wayne Witzel III
fd9d05d5df fixing deprecated_team.organization credential migration 2016-08-30 14:21:16 -04:00
Wayne Witzel III
2e4c26a77f remove the ORing of local roles, check against organization roles 2016-05-17 13:56:11 -04:00
Akita Noek
a6f735b4b9 Fixed call to role rebuilder during migrations 2016-04-27 15:27:52 -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
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
Wayne Witzel III
0309757439 Add parent ORing for Role field, renamed permissions -> active_roles 2016-04-21 15:54:36 -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
6d34ca9d22 Proof of concept hacks for RolePermission elimination 2016-04-15 10:03:50 -04:00
Akita Noek
8887db231b Progress on ripping out RolePermissions 2016-04-14 09:44:20 -04:00
Akita Noek
7b4e7ec5b3 Switch to explicitly stored implicit role parents
Completes #1496
2016-04-12 14:50:52 -04:00
Akita Noek
b77d8dab47 flake8 fixes
Signed-off-by: Akita Noek <anoek@ansible.com>
2016-04-12 12:04:39 -04:00
Akita Noek
7d2e660749 Make use of 'current' apps so RBAC ImplicitRoleField can work during migrations
While a migration is taking place, we can't juse use normal model
references like Role and RolePermission, nor can we use generic foreign
keys without manually referring to the content type and object id
fields.
2016-04-12 11:40:17 -04:00
Akita Noek
682552d9b0 Added field deconstruct method so ImplicitRoleField works in migrations
Apparently we need this, who'da known.
https://docs.djangoproject.com/en/1.9/howto/custom-model-fields/
2016-04-12 11:40:17 -04:00
Wayne Witzel III
24e20abb1b more unicode safety 2016-03-31 11:20:19 -04:00
Wayne Witzel III
fa67bd3f0e unicode safety 2016-03-31 10:24:09 -04:00
Akita Noek
7310f9aa44 Be lazier with original parent role computations to avoid unnecessary queries 2016-03-26 09:56:57 -04:00
Akita Noek
d8f527429c flake8 fixes 2016-03-22 08:05:04 -04:00
Akita Noek
ec851492d6 Fixed Role m2m binding so it even works all the time 2016-03-21 21:09:22 -04:00
Akita Noek
23f0286669 Refactored ImplicitRoleField to be faster and avoid some bad looping cases
The role creation logic was a bit too lazy and caused some looping when
using other roles as parent roles. This refactor does all role
creation for a single model instance up front together, which helps
avoid these situations as well as eliminates some extra db updates and
inserts that would happen the old way.
2016-03-18 15:10:08 -04:00
Akita Noek
ccfb73766c Code de-dup 2016-03-17 13:25:04 -04:00
Akita Noek
9909ea90c1 Fixed post delete behavior for roles, added test 2016-03-16 09:13:33 -04:00
Akita Noek
ce669b03ad Switched to a nicer contextmanager implemenation for role hierarchy rebuild batching
#1206
2016-03-15 15:30:43 -04:00
Akita Noek
b499555be4 Added auto_generated flag for RolePermissions 2016-03-15 13:36:28 -04:00
Wayne Witzel III
16673b1468 Fix the m2m_changed when accessed reversed 2016-03-11 15:59:01 -05:00
Wayne Witzel III
45483fb057 Refactor m2m_changed so reverse works 2016-03-11 15:18:24 -05:00
Wayne Witzel III
31a461956a Fixed up m2m_changed for rbac, added User.admin_role 2016-03-11 14:59:47 -05:00
Wayne Witzel III
55e071535b Added user role creation, accessible methods, and fixed up m2m_update 2016-03-11 07:07:17 -05:00
Akita Noek
87219135af Removed unneeded import 2016-03-09 10:39:31 -05:00
Akita Noek
9aae2979d9 Replaced our 'Resource' table with a GenericForeignKey in RolePermission 2016-03-09 10:12:05 -05:00
Akita Noek
db6117a56d Added role description fields
Completes #1096
2016-03-03 16:19:10 -05:00
Akita Noek
e94d441fb0 Add support for following parental changes on save and delete in the RBAC system 2016-02-29 16:59:20 -05:00
Akita Noek
26dc430c59 Look for and report on transaction errors within our implicit RBAC fields
When a transaction is in a failed state these fields will not be able to
create new role/resource entries. This check just makes it easier to see
what's going on and aids in debugging.
2016-02-22 16:25:09 -05:00
Wayne Witzel III
65c20e9de2 use objects instead of _default_manager 2016-02-18 13:36:36 -05:00
Wayne Witzel III
74e1554463 Only touch the attribute if it does not exist to avoid recursion in activity streams 2016-02-17 11:59:06 -05:00
Akita Noek
e2a428b9f5 Removed resource_field ImplicitRoleField
We just now assume that this field is always named 'resource'

 Completes functionality of #926, documentation next
2016-02-15 12:38:17 -05:00
Akita Noek
c77620f1ae Added support in ImplicitRoleField to handle following reverse m2m maps 2016-02-15 11:49:54 -05:00