[#4] Fix typo in auth functions
This commit is contained in:
parent
2f4cd3a4b0
commit
2ab10afcf9
|
@ -14,7 +14,7 @@ def harvest_source_create(context, data_dict):
|
||||||
try:
|
try:
|
||||||
pt.check_access('package_create', context, data_dict)
|
pt.check_access('package_create', context, data_dict)
|
||||||
return {'success': True}
|
return {'success': True}
|
||||||
except pt.Not_Authorized:
|
except pt.NotAuthorized:
|
||||||
return {'success': False,
|
return {'success': False,
|
||||||
'msg': pt._('User {0} not authorized to create harvest sources').format(user)}
|
'msg': pt._('User {0} not authorized to create harvest sources').format(user)}
|
||||||
|
|
||||||
|
@ -34,11 +34,10 @@ def harvest_job_create(context, data_dict):
|
||||||
raise pt.ObjectNotFound(pt._('Harvest source not found'))
|
raise pt.ObjectNotFound(pt._('Harvest source not found'))
|
||||||
|
|
||||||
context['package'] = pkg
|
context['package'] = pkg
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pt.check_access('package_update', context, data_dict)
|
pt.check_access('package_update', context, data_dict)
|
||||||
return {'success': True}
|
return {'success': True}
|
||||||
except pt.Not_Authorized:
|
except pt.NotAuthorized:
|
||||||
return {'success': False,
|
return {'success': False,
|
||||||
'msg': pt._('User not authorized to create a job for source {0}').format(source_id)}
|
'msg': pt._('User not authorized to create a job for source {0}').format(source_id)}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,6 @@ def harvest_source_update(context, data_dict):
|
||||||
try:
|
try:
|
||||||
pt.check_access('package_delete', context, data_dict)
|
pt.check_access('package_delete', context, data_dict)
|
||||||
return {'success': True}
|
return {'success': True}
|
||||||
except pt.Not_Authorized:
|
except pt.NotAuthorized:
|
||||||
return {'success': False,
|
return {'success': False,
|
||||||
'msg': pt._('User {0} not authorized to delete harvest source {1}').format(user, source_id)}
|
'msg': pt._('User {0} not authorized to delete harvest source {1}').format(user, source_id)}
|
||||||
|
|
|
@ -23,7 +23,7 @@ def harvest_source_show(context, data_dict):
|
||||||
try:
|
try:
|
||||||
pt.check_access('package_show', context, data_dict)
|
pt.check_access('package_show', context, data_dict)
|
||||||
return {'success': True}
|
return {'success': True}
|
||||||
except pt.Not_Authorized:
|
except pt.NotAuthorized:
|
||||||
return {'success': False,
|
return {'success': False,
|
||||||
'msg': pt._('User {0} not authorized to read harvest source {1}').format(user, source_id)}
|
'msg': pt._('User {0} not authorized to read harvest source {1}').format(user, source_id)}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ def harvest_source_update(context, data_dict):
|
||||||
try:
|
try:
|
||||||
pt.check_access('package_update', context, data_dict)
|
pt.check_access('package_update', context, data_dict)
|
||||||
return {'success': True}
|
return {'success': True}
|
||||||
except pt.Not_Authorized:
|
except pt.NotAuthorized:
|
||||||
return {'success': False,
|
return {'success': False,
|
||||||
'msg': pt._('User {0} not authorized to update harvest source {1}').format(user, source_id)}
|
'msg': pt._('User {0} not authorized to update harvest source {1}').format(user, source_id)}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue