FilteredPrimaryKeyRelatedField is a subclass of PrimaryKeyRelatedField
that filters its queryset by a permission.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Setting expected_content_type to None will now disable
the reponse HTTP content type checking. Added
to allow API tests to be a subclass of the test view test
case and support all the mixins without having to declare
them separately.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
For tests that required using two test permission, like
the tests for .restrict_queryset_by_accesses().
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This change allows filtering a queryset by multiple permission
following a logic operator to define the relationship.
Example: In order to access an instance of MetadataTypeDocumentType
the document type view and metadata type view permissions are
required. The computation for this access control can now be
coded using .restrict_queryset_by_accesses. Custom permission
checking in the view is no longer required.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Don't delete test models at the end of the test case.
Failed test cases don't execute the tearDown() method.
Instead perform model registry cleanup before creating
any new test model.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Add type casting to ExternalObjectListSerializerMixin via
the external_object_list_pk_type option.
Add an ExternalObjectSerializeMixin for related objects.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Update .get_inherited_permissions() to grab the permissions
of an object up the parent tree. Also add the role
permissions. Finally filter all the permissions by those
that apply to the object.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Convert the API to use viewsets.
The search function is now a service of the search model
resource.
The simple and advance search are now the same service. The
difference is determined by the URL query. A ?q= means a
simple search. For advanced search pass the search model
fields in the URL query, example: ?q=document_type__label=
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Reduce repeated code.
Add support for passing query string dictionary to
the test client.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Normalize API base names.
Update ViewSet base class, model classes are not needed
the OCR API views.
Split API tests into content and submit tests.
Puntuate view test strings.
Make use of success and title strings.
Make use of external object mixin in document type
settings view.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Add additional API and view tests.
Add success and multi document titles strings.
Make use of external mixin in the document type submit view.
Puntuate all view text strings.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Use viewsets for the events app API.
Use new link badge support for the unread notification
count display.
Remove AJAX workers support now that it is now needed
anymore.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Update serializers to be a subclass of
LazyExtraFieldsHyperlinkedModelSerializer to allow adding
more fields remotely.
Update URL fields to use MultiKwargHyperlinkedIdentityField.
Rename URL fields for uniformity.
Signed-off-by: Roberto Rosario <Roberto.Rosario.Gonzalez@mayan-edms.com>
Update the API routers registration to not duplicate
the document's URL parameter definition.
Signed-off-by: Roberto Rosario <Roberto.Rosario.Gonzalez@mayan-edms.com>
This refactor adds two new endpoints to view the OCR
content of versions and documents.
Signed-off-by: Roberto Rosario <Roberto.Rosario.Gonzalez@mayan-edms.com>