-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: alignment, move logic into logic folder and split auth and act…
…ions apart, move plugin from folder to root plugin.py
- Loading branch information
Showing
8 changed files
with
90 additions
and
87 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 |
---|---|---|
|
@@ -99,3 +99,4 @@ ENV/ | |
|
||
# mypy | ||
.mypy_cache/ | ||
.idea |
Empty file.
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import ckan.plugins.toolkit as tk | ||
|
||
|
||
def get_auth_functions(): | ||
validators = ( | ||
resource_validation_run, | ||
resource_validation_delete, | ||
resource_validation_show, | ||
resource_validation_run_batch, | ||
) | ||
|
||
return {"{}".format(func.__name__): func for func in validators} | ||
|
||
|
||
def resource_validation_run(context, data_dict): | ||
if tk.check_access(u'resource_update', context, | ||
{u'id': data_dict[u'resource_id']}): | ||
return {u'success': True} | ||
return {u'success': False} | ||
|
||
|
||
def resource_validation_delete(context, data_dict): | ||
if tk.check_access(u'resource_update', context, | ||
{u'id': data_dict[u'resource_id']}): | ||
return {u'success': True} | ||
return {u'success': False} | ||
|
||
|
||
@tk.auth_allow_anonymous_access | ||
def resource_validation_show(context, data_dict): | ||
if tk.check_access(u'resource_show', context, | ||
{u'id': data_dict[u'resource_id']}): | ||
return {u'success': True} | ||
return {u'success': False} | ||
|
||
|
||
def resource_validation_run_batch(context, data_dict): | ||
'''u Sysadmins only''' | ||
return {u'success': False} |
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
Oops, something went wrong.