[Product-Developers] How to add permissions and create Zope SQL
cvielma+nable at gmail.com
Wed May 13 17:59:04 UTC 2009
No no no. That's not what i meant.
I mean, i have 2 problems:
- One: i want to create a Zope Database Connection. I do in the __init__.py:
MySQL Goldmine', 'goldmine root pacm,Io09', 'YES')
and doesn't work. Also, i want to create a ZSQL method. I actually have a
.zsql file with the query on it, but when i install the product it doesn't
do anything (it fails when an standalone view try to use it, because
- Two: I want to restrict the users that can reach my standalone view. I do
in the __init__.py of the product:
"""Main product initializer
from Products.CMFCore.permissions import setDefaultRoles
# Define a message factory for when this product is internationalised.
# This will be imported with the special name "_" in most modules. Strings
# like _(u"message") will then be extracted by i18n tools for translation.
setDefaultRoles('MyProduct: MyPermission', ())
And when it try to install, it fails in rolemap.xml:
<role name="MyRole" />
<permission name="MyProduct: MyPermission"
<role name="MyRole" />
saying that ValueError: The permission "MyProduct: MyPermission" is invalid.
Andreas Jung-5 wrote:
> On 13.05.09 19:10, cvielma wrote:
>> Hi people!
>> Well i think my problem it's very stupid, but i have been more than a
>> in it :S
>> I want to make a very specialized product, that creates a form view where
>> the user put some search criteria and then another view that show the
>> results of a table in a relational database that match the criteria. It's
>> pretty simple.
>> So far, i went through the ZMI and created a database connection (MySQL),
>> and the ZSQL Method corresponding to the query. Also, i created the
>> standalone views in the product.
>> But i'm really stuck in creating a Zope Database Connection and ZSQL
>> I followed this:
>> http://plone.org/documentation/how-to/add-file-system-zsql-method and
>> Of course, also checked:
>> Also, i can't create a custom permission to the views (i want that only
>> role or group of users to view the form and query results). I have donde
> You want to redefine the permissions needed to execute ZSQL methods or
> something like
> that? That does not make much sense to me. If you need something
> different, wrap the original
> API calls within your own view. setDefaultRoles() can be used to
> introduce new permissions.
> Zope 2 permissions must be mapped to a Z3-ish permission within a
> permissions.zcml file.
> Look at existing code for examples.
> fn:Andreas Jung
> org:ZOPYX Ltd. & Co. KG
> adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
> email;internet:info at zopyx.com
> Product-Developers mailing list
> Product-Developers at lists.plone.org
View this message in context: http://n2.nabble.com/How-to-add-permissions-and-create-Zope-SQL-tp2885223p2885557.html
Sent from the Product Developers mailing list archive at Nabble.com.
More information about the Product-Developers