if you set the access control correctly and set the logical for that it can
be done, for menu i think you can do something like :
*controllers/install.py*
def index():
if db(db.auth_permission).isempty() and db(db.auth_membership).isempty():
# group
auth.add_group('Finance', 'Finance')
# user
db.auth_user.bulk_insert([{"first_name" : "Finance", "last_name" :
"Manager",
"email" : "[email protected]", "username" : "financemanager",
"password" : db.auth_user.password.validate("password")[0]}, ])
"""
membership (group_id, user_id)
"""
# Finance
auth.add_membership('1', '1')
session.flash = T('Installation Done')
redirect(URL("default", "index") )
*models/menu.py*
if auth.has_membership(role = 'Finance'):
response.menu += [
(T('Finance'), False, URL('default', 'index'), [
(T('Master'), False, URL('finance_master', 'index'), [
(T('Bank'), False, URL('finance_master', 'bank'), []),
]),
(T('Transaction'), False, URL('finance_transaction', 'index'), [
(T('Payment'), False, URL('finance_transaction', 'payment_cart'), []),
]),
(T('Report'), False, URL('finance_report', 'index'), [
(T('Payment'), False, URL('finance_report', 'report_payment'), []),
]),
]),
]
best regards,
stifan
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.