[ckan-dev] I need some help about code a plugin

Krzysztof Madejski krzysztof.madejski at epf.org.pl
Mon May 28 13:19:31 UTC 2018


I had to do the same for Polish data portal https://danepubliczne.gov.pl/.

Thinking about that: why you won't add category as a custom field that
doesn't have any core-ckan implications?


I think I've used groups as categories in Polish data (see how below), but
I'm not sure that's the right way to go now.

Look for clues in following commit. In 2.3 I haven't found a matching
IAuthInterface. I've tried to add members to categories after member
creation, but run into some bugs. In the end I've hacked it and overwritten
authorization function in custom IConfigurer.

Bear in mind that I've used 2.3 and in the current version solution for it
may exist.
Bear in mind that this is a HACK. CKAN dev team can give better clues, but
imho a way to go would be to introduce new IAuthInterface to overwrite
related authorization functions.

This commit
https://github.com/DanePubliczneGovPl/ckanext-danepubliczne/commit/d5560258aa7225f08f01c6a040a09048926c0274,
but check current codebase
<https://github.com/DanePubliczneGovPl/ckanext-danepubliczne/blob/develop/ckanext/danepubliczne/schema/dataset.py#L89>
as I don't remember how in the end it looks like.

Krzysztof


On 28 May 2018 at 02:38, Rafa <rafsalrob at gmail.com> wrote:

> We associate each dataset with an organization (town hall) and with one or
> more groups (economy, demography, commerce ... there are 22 groups). All
> users are administrators of an organization and the sysadmin must asocciate
> each user to each of the 22 existing groups.
>
> The problem is that the number of users is very high and we would like to
> add the option to give permissions on all groups automatically at the
> moment of user creation or by pressing a button.
>
>
> 2018-05-25 16:11 GMT+02:00 Krzysztof Madejski <
> krzysztof.madejski at epf.org.pl>:
>
>> What is your actual need? Why do you need to add user to all existing
>> groups? Maybe it can be achieved otherwise?
>>
>> On 25 May 2018 at 06:43, Rafa <rafsalrob at gmail.com> wrote:
>>
>>> Hi everyone!
>>>
>>> I need to develop an extension that hooks into the user register process
>>> and automatically adds that user to all existing groups in CKAN.
>>>
>>> Could anyone help me?
>>> Thanks.
>>>
>>> --
>>> --------------------------------------------------
>>> Rafael Salas Robledo
>>>
>>> _______________________________________________
>>> ckan-dev mailing list
>>> ckan-dev at lists.okfn.org
>>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>>>
>>>
>>
>>
>> --
>> *Krzysztof Madejski*
>> International Projects Manager
>> TransparenCEE <http://transparencee.org/>, Code for All
>> <https://codeforall.org/>, Code for Poland <http://codeforpoland.org>
>> krzysztof.madejski at epf.org.pl / +48 664 082 823
>> Skype: kangoor
>> <#m_8265778062773267069_m_4590806318320315890_UNIQUE_ID_SafeHtmlFilter_skype:kangoor?call> /
>> secure Tox
>> <#m_8265778062773267069_m_4590806318320315890_UNIQUE_ID_SafeHtmlFilter_tox:B1576C163FAEB83A8D1DEA8C5A6A29F5507F6AF1ADBEAC6A7DABB8C4D92A4026C4DB433EAE07>
>> / Slack CfA <http://codeforall-slackin.herokuapp.com/>, TCEE
>> <https://slack.transparencee.org/> / Hangouts/GDrive with email above
>>
>>
>> * <http://epf.org.pl/>*
>>
>> _______________________________________________
>> ckan-dev mailing list
>> ckan-dev at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/ckan-dev
>> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>>
>>
>
>
> --
> --------------------------------------------------
> Rafael Salas Robledo
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
>


-- 
*Krzysztof Madejski*
International Projects Manager
TransparenCEE <http://transparencee.org/>, Code for All
<https://codeforall.org/>, Code for Poland <http://codeforpoland.org>
krzysztof.madejski at epf.org.pl / +48 664 082 823
Skype: kangoor <#UNIQUE_ID_SafeHtmlFilter_skype:kangoor?call> / secure Tox
<#UNIQUE_ID_SafeHtmlFilter_tox:B1576C163FAEB83A8D1DEA8C5A6A29F5507F6AF1ADBEAC6A7DABB8C4D92A4026C4DB433EAE07>
/ Slack CfA <http://codeforall-slackin.herokuapp.com/>, TCEE
<https://slack.transparencee.org/> / Hangouts/GDrive with email above


* <http://epf.org.pl/>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20180528/bf996173/attachment-0002.html>


More information about the ckan-dev mailing list