Closed 0wenwu closed 4 years ago
Dear wuweihust, the installation looks ok, the error doesn't make much sense since the template 'resource_item.html' does exist. I have a different order on the plugins in the .ini configuration, just to test, could you put restricted as the first plugin in the ckan.plugins line? Good luck!
Thank you for your rapid response. I put restricted as the first plugin in the ckan.plugins line, but it still doesn't work. In fact, it is not that clear to me how to set up in development.ini and schema.json after all the relevant extension were installed. Firstly, the JSON file you showed in Readme should add to which file? Is that schema.json? Secondly, Readme says "ckanext.restricted.some_setting = some_default_value", what does this mean?
Dear wuweihust, the installation looks ok, the error doesn't make much sense since the template 'resource_item.html' does exist. I have a different order on the plugins in the .ini configuration, just to test, could you put restricted as the first plugin in the ckan.plugins line? Good luck!
Hi, sorry that with ckanext.restricted.some_setting = some_default_value is part of the default README, I will remove it to avoid confusion.
On the ini file you just need to add restricted (and scheming, composite, repeating) to the plugin list as you did.
The JSON I show is the one that is used for scheming, please take a look at the documentation of that extension, it defines all the fields of your datasets. On the ini file you write: scheming.dataset_schemas = ckanext.envidat_theme:restricted.json and then the presets too: scheming.presets = ckanext.scheming:presets.json ckanext.repeating:presets.json ckanext.composite:presets.json
Here you have an example of such a file: https://github.com/EnviDat/ckanext-envidat_schema/blob/master/ckanext/envidat_schema/datacite_dataset.json Or more simple: https://github.com/ckan/ckanext-scheming/blob/master/ckanext/scheming/ckan_dataset.json
That is the JSON file you add the restricted fields to (at resource level). You need scheming working first to then use this extension.
Thanks, Lucia. Very helpful directions. I'd like to ask one more question, Where should I put the schema.json? I See all the project put it under the "ckanext" folder, is that necessary? and how to quote the scheming configuration file built by ourselves?
No problem, feel free to ask :) Yes, the schema.json file should be inside a ckanext folder, that means inside an extension. In our case, we have a specific extension "envidat_theme" and we have the file in that extension. to use it, just add the following line to the ini file: scheming.dataset_schemas = ckanext.envidat_theme:schema.json If you want to use the default one in scheming extension, then you do: scheming.dataset_schemas = ckanext.scheming:ckan_dataset.json
I hope it helps!
Thx, it's very nice of you for the rapid reply.
Does it mean that I should build a extension first before I can make a self-defined schema json file?
Besides, I have installed ckanext-repeating from github
pip install git+https://github.com/eawag-rdm/ckanext-repeating.git@master
Should I install extension by downloading it and then running python setup.py develop
.
Maybe it will be more convenient for development?
Once I added restricted
to ckan.plugins
, the website of dataset will show "Internal server error".
And then I removed, dataset can be visited normally.
No problem, feel free to ask :) Yes, the schema.json file should be inside a ckanext folder, that means inside an extension. In our case, we have a specific extension "envidat_theme" and we have the file in that extension. to use it, just add the following line to the ini file: scheming.dataset_schemas = ckanext.envidat_theme:schema.json If you want to use the default one in scheming extension, then you do: scheming.dataset_schemas = ckanext.scheming:ckan_dataset.json
I hope it helps!
Sorry for the delay, and yes, it would be advisable to create your own extension if you wish to have a custom schema. I alternatively you can fork an existing one but we have chosen always to do our own extension.
Best, Lucia
On 28 May 2019, at 04:30, Owen Wu notifications@github.com wrote:
Thx, it's very nice of you for the rapid reply. I have installed ckanext-scheming by pip. So I can not modify the default json file directly. Does it mean that I should build a extension first before I can make a self-defined schema json file?
No problem, feel free to ask :) Yes, the schema.json file should be inside a ckanext folder, that means inside an extension. In our case, we have a specific extension "envidat_theme" and we have the file in that extension. to use it, just add the following line to the ini file: scheming.dataset_schemas = ckanext.envidat_theme:schema.json If you want to use the default one in scheming extension, then you do: scheming.dataset_schemas = ckanext.scheming:ckan_dataset.json
I hope it helps!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/EnviDat/ckanext-restricted/issues/10?email_source=notifications&email_token=ACYBP454GIAKZWMRGTAAUZTPXSKNNA5CNFSM4HP4IEIKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWKZNUA#issuecomment-496342736, or mute the thread https://github.com/notifications/unsubscribe-auth/ACYBP45DIONTHZQJ6AKDCYLPXSKNNANCNFSM4HP4IEIA.
Couldn't the .json be provided with the ckanext-restricted extension itself ? Seems a bit strange to require another extension to provide a default file for ckanext-restricted.
So I actually just figured out what was going on here – I just had my variables in the ini file set wrong! Easy fix!
From: olivierdalang notifications@github.com Sent: Monday, March 30, 2020 4:20 PM To: EnviDat/ckanext-restricted ckanext-restricted@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [EnviDat/ckanext-restricted] After setting up this extension, we have no access to all the datasets because of Internal server error (#10)
External.
Couldn't the .json be provided with the ckanext-restricted extension itself ? Seems a bit strange to require another extension to provide a default file for ckanext-restricted.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FEnviDat%2Fckanext-restricted%2Fissues%2F10%23issuecomment-606225827&data=02%7C01%7Cdjy38%40drexel.edu%7C70a553aaf7db411063b708d7d4e7c941%7C3664e6fa47bd45a696708c4f080f8ca6%7C0%7C0%7C637211964287617303&sdata=67eu1Hd%2FJtOylUYjfpN0J3otVhyuHcy2CxWxnD4r7tA%3D&reserved=0, or unsubscribehttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAMEE2DYW34B74U3GFJN4CX3RKD5IVANCNFSM4HP4IEIA&data=02%7C01%7Cdjy38%40drexel.edu%7C70a553aaf7db411063b708d7d4e7c941%7C3664e6fa47bd45a696708c4f080f8ca6%7C0%7C0%7C637211964287627297&sdata=NUNxzpu7HupoI1%2BnS1rldtCB4zJY1mk04WMFL%2FospVM%3D&reserved=0.
The json is dependent on the instance, we use a custom one if you are interested https://github.com/EnviDat/ckanext-envidat_theme/blob/master/ckanext/envidat_theme/datacite_dataset.json.
The extension is very useful to me. I intend to divide the user into two parts. One is who login the CKAN, and the other one is who don't login The former have the download access, and the latter just have only preview access.
So I did as the readme. There are some errors when I run the CKAN:
Here is some relevant content in my development.ini:
restricted.json is also listed below: