⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 acl.php

📁 a short sketch about linux syntex lines.
💻 PHP
字号:
<?php/*ACL路由验证array('guest'=>array('admin'=>'view,update'));*/class Easy_Acl {	public $_role;	public $denyRule;	public $allowRule;	public $roleId;	public function __construct(){			}	/*	$parent 集成父类的权限	$resouse 当前的对象	*/	public function addRole($resouse, $parent=null){				if (is_null($parent)){			$this->_role = $resouse;		}else{			$this->_role = $resouse;			if (is_array($parent) === false){				$this->_role->role[$resouse->roleId][] = $parent;			}else{				foreach ($parent as $row){					$this->_role->role[$resouse->roleId][] = $row;				}			}		}	}	public function Deny($role, $control, $rule){		if (is_object($role)){			$this->denyRule[$this->_role->roleId][$control] = $rule;		}else {			$this->denyRule[$role][$control] = $rule;		}	}	public function Allow($role, $control, $rule){		if (is_array($rule) == false){			$rule = explode(',', $rule);		}		if (is_object($role)){				$this->allowRule[$this->_role->roleId][$control] = $rule;		}else {			$this->allowRule[$role][$control] = $rule;		}	}	public function isAllow($name,$control, $rule){		$mygroup = $this->_role->role[$name];		array_push($mygroup, $name);		foreach ($mygroup as $role){			if(in_array($rule, $this->allowRule[$role][$control])){				return true;			}		}		return false;	}	public function isDeny($name,$control, $rule){		$mygroup = $this->_role->role[$name];		array_push($mygroup, $name);		foreach ($mygroup as $role){			if(in_array($rule, $this->allowRule[$role][$control])){				return true;			}		}		return false;	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -