throw new Horde_Exception((sprintf(_("\"%s\" share driver not found."), $driver)));
}
- $shares[$signature] = new $class($app);
+ $shares[$signature] = new $class($app, $this->_injector->getInstance('Horde_Perms'));
}
if (!isset($shares[$signature]) &&
protected $_shareObject;
/**
+ * The Horde_Perms object
+ *
+ * @var Horde_Perms
+ */
+ protected $_permsObject;
+
+ /**
* Constructor.
*
* @param string $app The application that the shares belong to.
+ * @param Horde_Perms The permissions object
*/
- public function __construct($app)
+ public function __construct($app, Horde_Perms $perms)
{
$this->_app = $app;
+ $this->_permsObject = $perms;
$this->__wakeup();
}
$share = $this->getShare($share);
}
- return $GLOBALS['injector']->getInstance('Horde_Perms')->getPermissions($share->getPermission(), $user);
+ return $this->_permsObject->getPermissions($share->getPermission(), $user);
}
/**
}
/**
+ * Getter for Horde_Perms object
+ *
+ * @return Horde_Perms
+ */
+ public function getPermsObject()
+ {
+ return $this->_permsObject;
+ }
+
+ /**
* Utility function to be used with uasort() for sorting arrays of
* Horde_Share objects.
*
if ($userid && $userid == $this->datatreeObject->get('owner')) {
return true;
}
- // TODO: inject
- return $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($this->getPermission(), $userid, $permission, $creator);
+
+ return $this->_shareOb->getPermsObject()->hasPermission($this->getPermission(), $userid, $permission, $creator);
}
/**
if ($userid == $this->data['share_owner']) {
return true;
}
- // @TODO: inject perms, don't use the injector here
- return $GLOBALS['injector']->getInstance('Horde_Perms')->hasPermission($this->getPermission(), $userid, $permission, $creator);
+ return $this->_shareOb->getPermsObject()->hasPermission($this->getPermission(), $userid, $permission, $creator);
}
/**