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 6580849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:04:43+00:00 2026-05-25T16:04:43+00:00

Zend_Acl by default disallow every role to every resource on every privilege untill or

  • 0

Zend_Acl by default disallow every role to every resource on every privilege untill or unless
they are specifically allowed.
In my system a user can have many roles and permission are assinged to these roles.
I simply get all user roles iterate over all of them and check isAllowed() for given resourse and privilege for every role.

for e.g if current resourse is ‘foo’ and privilege is ‘bar’

public function checkAllow($roles, $resouse, $privilege)
{

    foreach ($roles as $role) {
        if ($acl->isAllowed($role, 'foo', 'bar') === true)
            return true;
    }
    return false;
}

Now I want to implement sort order on these roles i.e first role assinged will have more preference then second and so forth.

Problem comes how can I detect specific deny to some roles like

$this->deny('member','foo','bar');

While iterating over all roles how can I know the given role was specificly “denyied”?
So at that point I can break out of foreach loop and return false.

  • 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-05-25T16:04:43+00:00Added an answer on May 25, 2026 at 4:04 pm

    Ok I found the solution myself by going into Zend_Acl code well its come out to be Zend_Acl is missing isDenied() Method , it has isAllowed() but not isDenied()

    Heres my implementation of isDenied() method in class which extends Zend_Acl

    public function isDenied($roleId,$resource,$privilege)
        {
    
            if($this->has($resource) && $this->hasRole($roleId))
            {
    
             $roleId = $this->getRole($roleId)->getRoleId();
             $resourceId = $this->get($resource)->getResourceId();   
    
           return @$this->_rules['byResourceId'][$resourceId]['byRoleId'][$roleId]['byPrivilegeId'][$privilege]['type'] === 'TYPE_DENY';
            }
    
            return false;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting the following error on every view available for the 'guest' user: Notice:
I set up a Zend_Acl and Zend_Auth scheme where user is authenticated using Zend_Auth_Adapter_Ldap
I want to allow resource to role using ACL in Zend framework I have
With Zend Framework Routing (Zend\Mvc\Router\RouteStack), how can I add a module to support user
Zend Project with multiple modules and every modules have its own routes.ini defined inside
I'm contemplating using Zend_ACL. However, to me it looks like you create roles and
I'm using Zend_Navigation and am trying to integrate it with Zend_Acl . Each page
i am using Zend_Acl , PHP and is wondering how shld ACLs be implemented.
i am using Zend Framework Zend_Acl i am wanting to throw an exception when
I'm trying to use Zend_acl in my application. I followed the Zend Framework in

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.