开发者

Defining a function to a Row

开发者 https://www.devze.com 2022-12-23 04:45 出处:网络
im making an application and i need to implement diferent level of user permits. I coul have the function

im making an application and i need to implement diferent level of user permits.

I coul have the function

$this->view->users->hasPermits($this->view->user);

By declaring a function on the model, an things could be easy to implement. But i would like to be able to have the next function doing the sa开发者_如何转开发me:

$this->view->user->hasPermits();

Is there a way to do this? do i need to extend the Zend_Db_Table_Row class? any ideas?


Use Zend_Acl for this.

There is a Zend ACL tutorial on YouTube.


If $user is a Zend_Db_Table_Row from the Zend_Db_Table $users, than in User you could perform the method like so:

public function hasPermits()
{
    return $this->getTable()->hasPermits($this);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消