This repository has been archived by the owner on Aug 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OpenConceptLab/ocl_issues#147: Users can view public collections that…
… are marked private if the user query is specified
- Loading branch information
Showing
6 changed files
with
68 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,7 @@ | ||
__author__ = 'snyaggarwal' | ||
|
||
from oclapi.filters import HaystackSearchFilter | ||
from oclapi.filters import ConceptContainerPermissionedSearchFilter | ||
|
||
|
||
class CollectionSearchFilter(HaystackSearchFilter): | ||
def get_filters(self, request, view): | ||
filters = super(CollectionSearchFilter, self).get_filters(request, view) | ||
if view.parent_resource: | ||
filters.update({'owner': view.parent_resource.mnemonic}) | ||
filters.update({'ownerType': view.parent_resource.resource_type()}) | ||
else: | ||
filters.update({'public_can_view': True}) | ||
|
||
return filters | ||
class CollectionSearchFilter(ConceptContainerPermissionedSearchFilter): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,7 @@ | ||
__author__ = 'misternando' | ||
|
||
from oclapi.filters import HaystackSearchFilter | ||
from oclapi.filters import ConceptContainerPermissionedSearchFilter | ||
|
||
__author__ = 'misternando' | ||
|
||
|
||
class SourceSearchFilter(HaystackSearchFilter): | ||
def get_filters(self, request, view): | ||
filters = super(SourceSearchFilter, self).get_filters(request, view) | ||
if view.parent_resource: | ||
filters.update({'owner': view.parent_resource.mnemonic}) | ||
filters.update({'ownerType': view.parent_resource.resource_type()}) | ||
else: | ||
filters.update({'public_can_view': True}) | ||
return filters | ||
class SourceSearchFilter(ConceptContainerPermissionedSearchFilter): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters