[ckan-discuss] Creating new roles

Ruben Martin ruben.martin at fundacionctic.org
Wed Feb 29 11:47:15 GMT 2012


Thank you Sean. Continues bellow...

2012/2/29 Sean Hammond <sean.hammond at okfn.org>:
> On 02/29/2012 09:37 AM, Ruben Martin wrote:
>>
>> Hi all again.
>>
>> Docs 1.5.1 mentions the possibility of creating new roles in addition
>> to the defaults. But i dont see any paster command to do that, nor any
>> web administration page. So can i do that?
>>
>> The objective would be to have the datasets in a site divided into
>> groups. Just users of a specific authorization group would have
>> permissions to add/edit datasets in the respective group.
>>
>> But when we i try to do something similar to this:
>> paster --plugin=ckan roles allow newroleX create-package read read-site
>> paster --plugin=ckan rights make agroup:agroupX newroleX group:groupX
>>
>> I get the error:
>> AssertionError: Role newroleX does not exist: anon_editor, admin, editor,
>> reader
>>
>> Thank you
>>
>
> Hi again Ruben,
>
> I'm only now learning about CKAN roles myself, but lets see if we an figure
> this out.
>
> If you second command (paster rights make ...) is telling you that newroleX
> doesn't exist then I'm guessing your first command (paster roles allow ...)
> didn't work. If you run `paster --plugin=ckan roles list`, what output do
> you get? Does it list your newroleX role?
>

Sorry if i was not clear enough. No, the command doesnt fail. And when
i list the roles,  newroleX is there:

(pyenv)ruben at ruben-laptop:~/pyenv/src/ckan$ paster --plugin=ckan roles list
newroleX            create-package, read-site, read
editor              read-site, read-user, create-user, edit,
create-package, create-group, create-authorization-group, read
anon_editor         edit, create-package, read-user, read-site, read
reader              read-site, read-user, read

I just meant i expected a direct way of creating the role (not
indirectly, assigning it actions). And thats all because when i try
now to use that new role newroleX, 'rigths' command does not recognize
it:

(pyenv)ruben at ruben-laptop:~/pyenv/src/ckan$ paster --plugin=ckan
rights make agroup:ibiasgrupo newroleX group:ibias
No handlers could be found for logger "vdm"
Traceback (most recent call last):
  File "/usr/bin/paster", line 18, in <module>
    command.run()
  File "/usr/lib/pymodules/python2.6/paste/script/command.py", line 84, in run
    invoke(command, command_name, options, args[1:])
  File "/usr/lib/pymodules/python2.6/paste/script/command.py", line
123, in invoke
    exit_code = runner.run(args)
  File "/usr/lib/pymodules/python2.6/paste/script/command.py", line 218, in run
    result = self.command()
  File "/home/ruben/pyenv/src/ckan/ckan/lib/authztool.py", line 97, in command
    role = self.ensure_role(unicode(role))
  File "/home/ruben/pyenv/src/ckan/ckan/lib/authztool.py", line 76, in
ensure_role
    ", ".join(roles))
AssertionError: Role newroleX does not exist: anon_editor, admin, editor, reader


> Assuming that the newroleX role has not been created:
>
> When I try your `paster roles allow ...` command I get an error because it
> has too many arguments. Try doing them one by one:
>
>
> paster --plugin=ckan roles allow newroleX create-package
> paster --plugin=ckan roles allow newroleX read
> paster --plugin=ckan roles allow newroleX read-site
>
> Then do `paster --plugin=ckan roles list` again to check if it worked.

Yes, you are right. Just thought the command allowed you to specify
several actions. But no, you have to do it one by one.


> --
> http://seanh.sdfeu.org/
>
> _______________________________________________
> ckan-discuss mailing list
> ckan-discuss at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-discuss



-- 

Rubén Martín Calderero

CTIC-Centro Tecnológico
Parque Científico y Tecnológico de Gijón
c/ Ada Byron, 39 Edificio Centros Tecnológicos
33203 Gijón - Asturias - España
Tel.: +34 984 29 12 12
Fax: +34 984 39 06 12
E-mail: ruben.martin at fundacionctic.org
http://www.fundacionctic.org
Política de Privacidad: http://www.fundacionctic.org/privacidad



More information about the ckan-discuss mailing list