[Product-Developers] How to add custom permissions to a Standalone View

cvielma cvielma+nable at gmail.com
Thu May 14 15:06:46 UTC 2009


Thank you very much!

But i still get the same error :S

When i placed the <include package="collective.autopermission" />  in the
configure.zcml it sayed "ConfigurationError: ('Invalid value for',
'package', "ImportError: Couldn't import collective, No module named
collective")" 

I included the collective.autopermission in the install_require and it seems
that it installed correctly. 

Also, i deleted then the "<include package="collective.autopermission" />" ,
and placed 
"<permission
      id="acmkms.goldmine.View"
      title="Goldmine: Consultar"
      description="Goldmine: Consultar"
      /> 
"

in the configure.zcml, giving me the same "permission invalid" error than
before...

I'm still reading about it, i'm sure it's quite simple but i don't get it
work...

Greetings,


Tim Knapp wrote:
> 
> On Wed, 2009-05-13 at 13:21 -0700, cvielma wrote:
>> Hi there people!
>> 
>> Due to a senseless discuss with a very frustrated guy, and in order to
>> show
>> my problem better, i decided to separate my early post in two problems.
>> 
>> I have an standalone view, and i want to make a product that adds
>> permission
>> to access that view to some users (maybe a role).
>> 
>> I have followed this
>> http://plone.org/documentation/how-to/adding-a-custom-permission-to-a-plone-2-5-product. 
>> 
>> My product schema has the following: 
>> 
>> - profiles/
>>      - default/
>>             - rolemap.xml
>>                          <?xml version="1.0"?>
>>                          <rolemap>
>>                            <roles>
>>                              <role name="MyRole" />
>>                            </roles>
>>                            <permissions>
>>                                <permission name="MyProduct: MyPermission"
>>                                           acquire="True">
>>                                    <role name="MyRole" />
>>                              </permission>
>>                            </permissions>
>>                          </rolemap> 
>>             - import-steps.xml:
>>                          <?xml version="1.0"?>
>>                          <import-steps>
>>                           <import-step id="goldmine-permisos"
>> version="20090512-01"
>>                                        
>> handler="acmkms.goldmine.setuphandlers.createPermission"
>>                                         title="Crear permiso nuevo para
>> conexion con Goldmine">
>>                           </import-step>
>>                           </import-steps>
>> - configure.zcml:
>>                           <configure
>>                          xmlns="http://namespaces.zope.org/zope"
>>                          xmlns:five="http://namespaces.zope.org/five"
>>                         
>> xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
>>                          i18n_domain="acmkms.goldmine">
>>                           <!-- Include the sub-packages that use their
>> own
>> configure.zcml files. -->
>>                              <include package=".browser" />
>>                              <include package=".zsql" />
>>                              <!-- Register the installation GenericSetup
>> extension profile -->
>>                              <genericsetup:registerProfile
>>                                name="default"
>>                                title="Goldmine"
>>                                directory="profiles/default"
>>                                description="Provee interfaces y los
>> requerimientos para realizar consultas a Goldmine desde ACMKMS."
>>                               
>> provides="Products.GenericSetup.interfaces.EXTENSION"
>>                                />
>>                          </configure>
>> - __init__.py (empty)
>> - setuphandlers.py
>>                           from Products.CMFCore.permissions import
>> setDefaultRoles
>>                           def createPermission(portal):    
>>                               setDefaultRoles('MyProduct: MyPermission',
>> ())
>> 
>> I do buildout and then when i try to install, plone says to me that the
>> package broken, and the error is: ValueError: The permission
>> <em>Goldmine:
>> Consultar</em> is invalid.
>> 
>> Does anyone know where maybe the problem, or what i'm doing wrong?
>> 
>> Thanks in advance to not frustrated helping guys!
> 
> Have a look at collective.autopermission it solves these kinds of issues
> and means you don't need to worry about using setDefaultRoles ==
> 'simpler' (the KISS principle :)
> 
> You'll need to include it in your eggs 'install_requires=' line and also
> do an <include package="collective.autopermission" /> at the top of your
> configure.zcml.
> 
> HTH,
> Tim
> 
> [1] http://pypi.python.org/pypi/collective.autopermission
> 
> -Tim
> 
>> 
>> Greetings, 
> 
> 
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers
> 
> 

-- 
View this message in context: http://n2.nabble.com/How-to-add-custom-permissions-to-a-Standalone-View-tp2886331p2892458.html
Sent from the Product Developers mailing list archive at Nabble.com.





More information about the Product-Developers mailing list