The SimpleInvoices forum has moved to Google Plus - this forum is now read-only
'Lost' users if created with no role
  • NickElliottNickElliott March 2010

    If you don't assign a role when adding a new user they do not appear on the user list screen, effectively they are lost from the system.

    The only way round this is to edit the database table directly which I suspect is not something that most people would want to do.

    Nick

  • VeGaTrOnVeGaTrOn March 2010

    hi Nick

    I've had this annoying problem before, which drove me insane trying to get it to work

    open phpmyadmin , go your simpleInvoces DB->user_role table
    you'll find one role there whch is the administrator, add roles to it like (biller , customer, warehouse ..) each with a different unique id

    now you can add users, and to set different permission for the users , go to the acl.php (includes directory) and assign roles to them
    here is my biller role:

    $acl->allow('biller');
    $acl->deny('biller','options');
    $acl->deny('biller','system_defaults');
    $acl->deny('biller','custom_fields');
    $acl->deny('biller','user');
    $acl->deny('biller','tax_rates');
    $acl->deny('biller','preferences');
    $acl->deny('biller','payment_types');

  • NickElliottNickElliott March 2010

    Hello VeGaTrOn,

    Fantastic, works a treat! I'm new to MySQL and PHP but I think I'll soon get the hang of it, especially with help like this.

    Thanks,

    Nick

  • kwalkwal March 2010

    Hi VeGaTrOn,

    I followed your recommendations.

    The si_user_role table now has the new row id=4 and name=clerk
    The si_user table now has a new user email=bobby role_id=4 domain_id=1 enabled=1 and the password is set.

    So accordingly I added this to the bottom of the acl.php file:
    $acl->allow('clerk');
    $acl->deny('clerk','options');
    $acl->deny('clerk','system_defaults');
    $acl->deny('clerk','custom_fields');
    $acl->deny('clerk','user');
    $acl->deny('clerk','tax_rates');
    $acl->deny('clerk','preferences');
    $acl->deny('clerk','payment_types');

    Rebooted all the systems.

    Now when I try to login via the usual URL http://192.168.2.18/simpleinvoices/
    It does NOT even show the login screen, instead it shows:
    -------------
    Fatal error: Uncaught exception 'Zend_Acl_Role_Registry_Exception' with
    message 'Role 'clerk' not found' in /var/www/simpleinvoices/library/Zend/Acl/Role/Registry.php:132
    Stack trace:
    #0 /var/www/simpleinvoices/library/Zend/Acl.php(742): Zend_Acl_Role_Registry->get('clerk')
    #1 /var/www/simpleinvoices/include/check_permission.php(7): Zend_Acl->isAllowed('clerk', NULL, NULL)
    #2 /var/www/simpleinvoices/include/init.php(177): include_once('/var/www/simple...')
    #3 /var/www/simpleinvoices/index.php(26): require_once('/var/www/simple...')
    #4 {main} thrown in /var/www/simpleinvoices/library/Zend/Acl/Role/Registry.php on line 132
    -------------

    What did I miss?

    Thanks,

    kwal

  • VeGaTrOnVeGaTrOn March 2010

    Nick, you're welcome

    kwal
    I forgat to mension that the role has to be defined to the acl.php script, the error you got because you didnt define clerk as a role

    just add the following line
    $acl->addRole(new Zend_Acl_Role('clerk'));
    below
    $acl->addRole(new Zend_Acl_Role('administrator'));

  • NickElliottNickElliott March 2010

    VeGaTrOn, you just beat me to it!

  • kwalkwal March 2010

    VeGaTrOn,

    Thanks. That did it.
    Now I can limit access for clerks AND give full access to the business owner.

    For the clerks, I also need to deny access to the following:
    * Add New Product
    * Edit Product
    * Add Customer
    * Edit Customer
    * Add New Biller
    * Edit Biller

    (The business owner will take responsibility of these features.)

    Which modules do I specify in
    $acl->deny('clerk','???????');
    to enforce it?

    Thanks again.

  • kwalkwal March 2010

    Never mind, I figured it out.
    All the modules are listed at the top of the "acl.php" file.

  • YorkYork May 2011

    is it possible to create user groups and restrict each group can't see others groups' items?

    Thanks!

  • bossturbobossturbo September 2011

    How can I restrict the biller to see only their invoices?

  • GabeliGabeli February 2012

    @VeGaTrOn

    It works great. Thank you very much :-}

  • daydahdaydah February 2013

    God bless you @VeGaTrOn!

Categories