Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7983981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:07:28+00:00 2026-06-04T11:07:28+00:00

I want to allow resource to role using ACL in Zend framework I have

  • 0

I want to allow resource to role using ACL in Zend framework

I have modules privileges and account.

privileges module has users and privilege controllers.
each controller has index, view and edit actions.

How can I grant action aresource to role? The problem I face that I can grant access to whole module but I can’t give access to specific action in controller..

    $this->addRole(new Zend_Acl_Role('admin'));

    $this->add(new Zend_Acl_Resource('privileges'))
            ->add(new Zend_Acl_Resource('privileges-privilege'))
            ->add(new Zend_Acl_Resource('privileges-users'))
            ->add(new Zend_Acl_Resource('account'))
            ->add(new Zend_Acl_Resource('default'));


    $this->deny('admin'); //deny every thing
    $this->allow('admin', 'account');
    $this->allow('admin', 'privileges-privilege' , array('index','view','edit'));

and also I make another way

 $this->add(new Zend_Acl_Resource('privileges'))
      ->add(new Zend_Acl_Resource('privilege'), 'privileges')
       ->add(new Zend_Acl_Resource('Privilege'),array('index','view','edit'))
      ->add(new Zend_Acl_Resource('users', 'privileges'))
      ->add(new Zend_Acl_Resource('account'))
      ->add(new Zend_Acl_Resource('account:account'), 'account')
      ->add(new Zend_Acl_Resource('default'));

     $this->deny('admin'); //deny every thing
    $this->allow('admin', 'account');
      $this->allow('admin', 'Privilege', array('index','view','edit'));

but it doesn’t work, making both ways cause the same problem, which not granting any access to privilege module! and just allow account module..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:07:29+00:00Added an answer on June 4, 2026 at 11:07 am

    I make it, I make concatenation between module and controller, I make like this

    moduleName-ControllerName .

    I pass role and the concatenated module and controller as resources and action is the privilege.

         if (!$this->_acl->isAllowed($role, $request->getModuleName() . '-' . $request->getControllerName(), $request->getActionName())) {
                    $request->setModuleName('account')
                    ->setControllerName('account')
                    ->setActionName('error');
                     return false;
        } 
    

    and here how I add the resources

          $this->add(new Zend_Acl_Resource('privileges'))
                ->add(new Zend_Acl_Resource('privileges-privilege'))
                ->add(new Zend_Acl_Resource('privileges-users'))
                ->add(new Zend_Acl_Resource('privileges-index'))
                ->add(new Zend_Acl_Resource('account'))
                  ->add(new Zend_Acl_Resource('account-account'))
                ->add(new Zend_Acl_Resource('default'))
                ->add(new Zend_Acl_Resource('error'))
                ->add(new Zend_Acl_Resource('default-index'));
    
    
    
        // $this->allow('admin'); //allow every thing
        $this->allow('admin', 'account-account');
        $this->allow('admin', 'default');
        $this->allow('admin', 'default-index');
        $this->allow('admin', 'privileges-users', array('index','add-User','get-Group-Users'));
        $this->allow('admin', 'privileges-index', 'index');
        $this->allow('admin', 'privileges-privilege', array('index', 'get-privileges', 'update-privileges','get-User-Privileges','get-Group-Privileges'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to allow users of my application to add sub-users and set privileges
I have a projects resource that has many tasks. I want to ensure that
Suppose I have the classes/models Projects (has many lists) Lists I want to allow
I have a REST data service where I want to allow the users to
I want to allow users to put in am img url instead of uploading
I want to allow the end-users of my web application to modify views (via
I'm using an HTML5 manifest to allow an application to work offline. I have
I have the following model and I want to allow user to join the
I have a link that will allow users to click it and it fetches
I have a Spring project that uses Maven and has several profiles to allow

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.