Determines whether or not a user has some permission on a given object
@param string $permission
@param mixed $object
@param User\UserInterface|null $user
@return boolean
425733
public function userCan($permission, $object, $user = null)
	{
		// if no user is specified, default to the Auth one
		if(is_null($user))
		{
			$user = app('auth')->user();
		}
		
		$adminGroups = $this->groupProvider()->findAdminGroups();
		
		if($adminGroups->count() > 0 && $user->inGroup($adminGroups))
			return true;
		
		// find the exact permission for the object
		$permObject = $this->permission->findByPermissionAndObject($permission, $object);
		
		// if the permission object doesn't exist, then they don't have access
		if(!$permObject)
			return false;
		
		// if the user has direct permission, allow
		$uop = $this->userObjectPermission->findPermission($user, $object, $permObject);
		
		if($uop)
			return true;
		
		// get all the groups that have that specific permission on the object
		$gop = $this->groupObjectPermission->findPermissions($object, $permObject);
		
		// if there are no groups, deny
		if(count($gop) == 0)
			return false;
		
		// get all the relevant groups
		$groups = array();
		foreach($gop as $onePermission)
		{
			$groups[] = $onePermission->getGroup();
		}
		
		// allow or deny based on whether the user is in those groups
		return $user->inGroup($groups);
	}
1204582
public function hasPermission($permissionName, Subject $subject, Resource $resource = null, array $params = [])
    {
        return in_array($permissionName, $this->getPermissions($subject, $resource, $params));
    }
1337775
protected function hasPermission(string $permission, bool $return = false)
    {
        $auth = $this->getContext()->getAuthentication();
        $user = $auth->getUser();
        $acl = $this->getContext()->getAccessControlList();

        if (!$acl->hasAccess($user, $permission)) {

            if ($return) {
                return false;
            }else{
                throw HttpException::forbidden('The current user has no permission to this action');
            }
        }

        return true;
    }
269537
public function getGroups($permission, $object)
	{
		$permObject = $this->permission->findByPermissionAndObject($permission, $object);
		
		if(!$permObject)
			return array();
		
		return $this->groupObjectPermission->findByObject($permObject, $object);
	}
1316323
public static function require (string $permission): bool {
		if (empty($permission)) {
			return true;
		}

		return self::$user->hasPermission($permission);
	}
245795
public function hasPermissions($permissions)
    {
        if ($this->user() === null) {
            return null;
        }

        if (!is_array($permissions)) {
            $permissions = func_get_args();
        }

        // Count permissions because user need user to have all permissions passed as parameter
        return count(array_intersect($permissions, $this->permissions)) === count($permissions);
    }
1119326
public function hasPermission($permission)
    {
        if ($this->id == self::ADMINISTRATOR_ID) {
            return true;
        }

        return $this->permissions->contains('permission', $permission);
    }
20436
public function disallowUser($permissions, $object, $user = null)
	{
		// if no user is specified, default to the Auth one
		if(is_null($user))
		{
			$user = app('auth')->user();
		}
		
		if(!is_array($permissions))
		{
			$permissions = array($permissions);
		}
		
		foreach($permissions as $permission)
		{
			$this->disallowSinglePermission($permission, $object, $user);
		}
	}
1269437
public boolean hasPermissionForUser(String user, String... permission) {
        List<String> params = new ArrayList<>();

        params.add(user);
        Collections.addAll(params, permission);

        return hasPolicy(params);
    }
219285
public boolean hasPermissionForUser(String user, List<String> permission) {
        return hasPermissionForUser(user, permission.toArray(new String[0]));
    }
252221
public function hasPermission ($permission = null, $and = false)
		{
			if (Yii::$app->user->can(User::R_ADMIN))
				return true;

			if ($permission == null)
				return false;

			if (is_string($permission))
			{
				return Yii::$app->user->can($permission, [], false);
			}
			elseif (is_array($permission))
			{
				foreach ($permission as $item)
				{
					if ($and)
					{
						if (!Yii::$app->user->can($item, [], false))
							return false;
					}
					else
					{
						if (Yii::$app->user->can($item, [], false))
							return true;
					}
				}
			}

			return false;
		}
424444
public function hasPermission($permission)
    {
        $permissions = $this->permissions;
        foreach ($permissions as $permission_obj)
            if ($this->checkPermission($permission, $permission_obj))
                return true;

        return false;
    }
536353
public function grantAccessByPermissions($permissions, UserInterface $user = null)
    {
        $user = $user ? : $this->currentUser;
        return count(array_diff($permissions, $this->gatherPermissions($user))) === 0;
    }
465000
public function isAuthorized($user = null) {
        parent::isAuthorized($user);

        if (!$this->Acl->check(array(USER_MODEL => $user), $this->Model->qualifiedName, 'read')) {
            throw new UnauthorizedException(__d('admin', 'Insufficient Access Permissions'));
        }

        return true;
    }
1056629
public function hasAccess(UserInterface $user, string $permission) : bool
    {
        return $this->provider->hasRolePermission($user->getRole(), $permission);
    }
1130036
public function allowGroup($permissions, $object, $group)
	{
		if(!is_array($permissions))
		{
			$permissions = array($permissions);
		}
		
		foreach($permissions as $permission)
		{
			$this->allowSingleGroupPermission($permission, $object, $group);
		}
	}
839669
def has_object_permission(self, request, view, obj):
        
        return (
            request.user.is_superuser or
            super(IAWPOrSuperuser, self).has_object_permission(
                request=request, view=view, obj=obj
            )
        )