Commit Graph

42 Commits

Author SHA1 Message Date
Roberto Rosario
79cba7abe1 Improve the resolve_attribute function
Update the arguments of the function to be full length and more explicit.
Use exceptions to find the correct way of using the attribute of the
object passed instead of trying to use introspection.
Add support for passing key word arguments to the attribute being
resolved even if it is a class method.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
2018-12-21 23:41:38 -04:00
Roberto Rosario
1efec6bd41 Navigation: Related field support to SourceColumn
Add support to the SourceColumn class to resolve related fields
using the double underscore as separator. Columns that use related
no longer have to use throw away lambdas.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
2018-12-14 02:15:49 -04:00
Roberto Rosario
55a30379bd Various apps: Sort imports
Run imports as per Mayan EDMS best practices.

Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
2018-12-06 01:57:24 -04:00
Roberto Rosario
8e69178e07 Project: Switch to full app paths
Instead of inserting the path of the apps into the Python app,
the apps are now referenced by their full import path.

This app name claves with external or native Python libraries.
Example: Mayan statistics app vs. Python new statistics library.

Every app reference is now prepended with 'mayan.apps'.

Existing config.yml files need to be updated manually.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2018-12-05 02:04:20 -04:00
Roberto Rosario
75f6d44509 Add to the AccessControlList parent accesor code to handle related fields.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2018-08-23 16:20:35 -04:00
Michael Price
e2cc939260 Fix indentation.
Signed-off-by: Michael Price <loneviking72@gmail.com>
2018-04-01 18:39:04 -04:00
Michael Price
3165912837 Format line according to best practices.
Signed-off-by: Michael Price <loneviking72@gmail.com>
2018-04-01 18:36:30 -04:00
Michael Price
e3d400c70d Add common.utils.return_related function to support double underscore related model references.
Signed-off-by: Michael Price <loneviking72@gmail.com>
2018-04-01 18:21:26 -04:00
Roberto Rosario
4dcaa5f883 Add text description to the PermissionDenied exception raised by
the acls managers.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-08-26 02:54:43 -04:00
Roberto Rosario
2052caada4 Remove PreserveGetQuerySet mixin. Update SingleObjectList and
MultipleObjectFormActionView views to use a new get_object_list method.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-08-16 22:12:24 -04:00
Roberto Rosario
3cbe90567f Add method to grant and revoke access via ACLs.
Granting will also check if the permission has been
authorized to the object class using ModelPermission.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-07-17 20:39:41 -04:00
Roberto Rosario
e04e3040bb Allow model ACL inheritance related to be a callable.
If it is a callable iterative queryset filter will be performed.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-07-14 05:13:32 -04:00
Roberto Rosario
63682a2945 Merge remote-tracking branch 'origin/master' into feature/master_merge
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
2017-03-14 15:57:38 -04:00
Roger Hunwicks
ed0145cc1c More detailed logging for permissions checks - see #321
Signed-off-by: Roger Hunwicks <roger@tonic-solutions.com>
2017-02-23 16:29:20 +02:00
Roberto Rosario
1133577e4d Fix ACL resolution for non model objects. 2016-11-14 02:57:41 -04:00
Roberto Rosario
5893e149e0 Reduce the check_access boilerplate code. 2016-11-02 04:58:05 -04:00
Roberto Rosario
621c988809 Simplify filter_by_access boilerplate code 2016-11-02 03:48:16 -04:00
Roberto Rosario
e3200511ac Small query optimization. 2016-04-04 23:04:35 -04:00
Roberto Rosario
739b96ed37 Add related object link permission support. 2016-03-29 16:27:53 -04:00
Roberto Rosario
e708e0250e Support related object permission ACLs for more than just 1 level of relationship. 2016-03-27 03:28:14 -04:00
Roberto Rosario
8c1d5319dd Test an object's parent for permission but also test the child object if the parent test fails. 2015-11-01 02:47:24 -04:00
Roberto Rosario
7b2eae4b5c ACL access check now check the object for permission inheritance too. IE: page navigation links. 2015-10-28 01:06:18 -04:00
Roberto Rosario
6d80b40ed4 Remove unused related parameter for the ACL filter method. 2015-10-21 03:40:13 -04:00
Roberto Rosario
ff97dd55e7 Implement related object ACL access check. 2015-08-14 14:50:55 -04:00
Roberto Rosario
1e746c700a PEP8 cleanups. 2015-07-27 23:53:14 -04:00
Roberto Rosario
4527563d89 PEP8 cleanups, specially E501 line too long. 2015-07-22 18:21:37 -04:00
Roberto Rosario
8d7a9df7e8 Add optimization reminder. 2015-07-13 23:44:43 -04:00
Roberto Rosario
ba1e36146d Calculate inherited permission by id of parent object not pk of ACL of parent. 2015-07-13 19:44:45 -04:00
Roberto Rosario
ee83624704 Don't fail if model has not inherited permissions. 2015-07-13 02:28:24 -04:00
Roberto Rosario
76c3ff7374 Remove the acl filter option 'exception_on_empty'. 2015-07-10 01:49:42 -04:00
Roberto Rosario
bc3eed143c Add permission inheritance by parent object. Add ACLs app model tests. 2015-07-10 01:40:21 -04:00
Roberto Rosario
f0cfe314f0 PEP8 cleanups 2015-07-01 16:45:33 -04:00
Roberto Rosario
49f86cd331 Finish refactoring access control list's queryset filtering by access level code. 2015-07-01 16:33:07 -04:00
Roberto Rosario
f65fb2cd6c Remove anonymous user support 2015-07-01 02:45:58 -04:00
Roberto Rosario
ee1b05fb57 Refactor code to associate a model with a set of permissions. Update related apps. 2015-06-30 22:00:14 -04:00
Roberto Rosario
070c3b648c Refactor acls app 2015-06-30 02:38:22 -04:00
Roberto Rosario
5be41af1cf Remove DefaultAccessControlList support 2015-06-29 14:51:37 -04:00
Roberto Rosario
3754f45001 Reduce checked out document column label string size. Refactor roles: roles can only have groups as members, only roles can hold permissions. 2015-06-29 14:07:02 -04:00
Roberto Rosario
1c084aa07b Split Permission and StoredPermission class and model into different modules. Simplified the Permission class. 2015-06-28 01:03:29 -04:00
Roberto Rosario
d59ea3ede2 Add from __future__ import unicode_literals, issue #37 2015-01-19 04:06:40 -04:00
Roberto Rosario
ba1729106f Pass arguments to the logger the correct way 2014-11-02 20:55:21 -04:00
Roberto Rosario
ec1745b50b Initial changes to support the new Django 1.6 project structure 2014-06-15 13:13:21 +02:00