Révision 5c4e0677
Ajouté par Serghei Mihai il y a environ 9 ans
ckanext/ozwillo_organization_api/plugin.py | ||
---|---|---|
8 | 8 |
import ckan.plugins.toolkit as toolkit |
9 | 9 |
|
10 | 10 |
import ckan.logic as logic |
11 |
import ckan.lib.base as base |
|
11 | 12 |
|
12 | 13 |
from pylons import config |
13 | 14 |
from ckan.common import request, _ |
... | ... | |
170 | 171 |
return schema |
171 | 172 |
|
172 | 173 |
|
174 |
class ErrorController(base.BaseController): |
|
175 |
def error403(self): |
|
176 |
return base.abort(403, '') |
|
177 |
|
|
178 |
|
|
173 | 179 |
class OzwilloOrganizationApiPlugin(plugins.SingletonPlugin): |
174 | 180 |
""" |
175 | 181 |
API for OASIS to create and delete an organization |
176 | 182 |
""" |
177 | 183 |
plugins.implements(plugins.IActions) |
178 | 184 |
plugins.implements(plugins.IConfigurer) |
185 |
plugins.implements(plugins.IRoutes) |
|
186 |
|
|
187 |
def before_map(self, map): |
|
188 |
# disable organization and members api |
|
189 |
for action in ('member_create', 'member_delete', |
|
190 |
'organization_member_delete', |
|
191 |
'organization_member_create', |
|
192 |
'organization_create', |
|
193 |
'organization_update', |
|
194 |
'organization_delete'): |
|
195 |
map.connect('/api/{ver:.*}/action/%s' % action, |
|
196 |
controller=__name__ + ':ErrorController', |
|
197 |
action='error403') |
|
198 |
return map |
|
199 |
|
|
200 |
def after_map(self, map): |
|
201 |
return map |
|
179 | 202 |
|
180 | 203 |
def update_config(self, config): |
181 | 204 |
toolkit.add_template_directory(config, 'templates') |
Formats disponibles : Unified diff
access to organizations and members APIs forbidden