/** * Stores the configuration. Calls the parent configuration first, * then does additional operations. * * @param object Properties $configuration * @return object * @access public * @since 3/24/05 */ function assignConfiguration(Properties $configuration) { // Set the configuration values to our custom values. $configuration->addProperty('authentication_table', 'auth_visitor'); $configuration->addProperty('username_field', 'email'); $configuration->addProperty('password_field', 'password'); $propertiesFields = array('name' => 'display_name', 'email' => 'email'); $configuration->addProperty('properties_fields', $propertiesFields); try { ArgumentValidator::validate($configuration->getProperty('email_from_name'), NonzeroLengthStringValidatorRule::getRule()); } catch (InvalidArgumentException $e) { throw new ConfigurationErrorException("'email_from_name' must be a string. " . $e->getMessage()); } try { ArgumentValidator::validate($configuration->getProperty('email_from_address'), RegexValidatorRule::getRule('/^.+@.+$/')); } catch (InvalidArgumentException $e) { throw new ConfigurationErrorException("'email_from_address' must be an email address. " . $e->getMessage()); } try { ArgumentValidator::validate($configuration->getProperty('domain_blacklist'), OptionalRule::getRule(ArrayValidatorRuleWithRule::getRule(NonzeroLengthStringValidatorRule::getRule()))); ArgumentValidator::validate($configuration->getProperty('domain_whitelist'), OptionalRule::getRule(ArrayValidatorRuleWithRule::getRule(NonzeroLengthStringValidatorRule::getRule()))); } catch (InvalidArgumentException $e) { throw new ConfigurationErrorException("'domain_blacklist' and 'domain_whitelist' if specified must be arrays of domain name strings. " . $e->getMessage()); } parent::assignConfiguration($configuration); }
/** * The constructor. * @param object id The id of this Authorization * @param ref object agentId The Id of the agent. * @param ref object functionId The Id of the function. * @param ref object qualifierId The Id of the qualifier. * @param integer effectiveDate The date when the authorization becomes effective. * @param integer expirationDate The date when the authorization expires. * @param boolean explicit Specifies whether this Authorization is explicit or not. * @access public */ function __construct($id, Id $agentId, Id $functionId, Id $qualifierId, $explicit, AuthZ2_AuthorizationCache $cache, $effectiveDate = NULL, $expirationDate = NULL) { // ** parameter validation ArgumentValidator::validate($id, OptionalRule::getRule(StringValidatorRule::getRule()), true); ArgumentValidator::validate($effectiveDate, OptionalRule::getRule(HasMethodsValidatorRule::getRule('asDateAndTime')), true); ArgumentValidator::validate($expirationDate, OptionalRule::getRule(HasMethodsValidatorRule::getRule('asDateAndTime')), true); ArgumentValidator::validate($explicit, BooleanValidatorRule::getRule(), true); // ** end of parameter validation // make sure effective date is before expiration date if (isset($effectiveDate) && isset($expirationDate)) { if ($effectiveDate > $expirationDate) { $str = "The effective date must be before the expiration date."; throwError(new Error($str, "Authorization", true)); } } $this->_id = $id; $this->_agentId = $agentId; $this->_functionId = $functionId; $this->_qualifierId = $qualifierId; if (isset($effectiveDate)) { $this->_effectiveDate = $effectiveDate; } if (isset($expirationDate)) { $this->_expirationDate = $expirationDate; } $this->_explicit = $explicit; $this->_cache = $cache; }
/** * Constructor * * @param object XmlSiteDirector $director * @param object DOMElement $element * @return object XmlSiteNavBlockSiteComponent * @access public * @since 4/3/06 */ function __construct(AssetSiteDirector $director, Asset $asset, $element) { ArgumentValidator::validate($element, OptionalRule::getRule(ExtendsValidatorRule::getRule('DOMElement'))); $this->_director = $director; $this->_asset = $asset; $this->_element = $element; }
/** * Answer an internal Url string with the array values added as parameters. * * @param array $parameters Associative array ('name' => 'value') * @return string * @access public * @since 1/13/06 */ public final function url($parameters = array()) { ArgumentValidator::validate($parameters, OptionalRule::getRule(ArrayValidatorRule::getRule())); $url = $this->_baseUrl->deepCopy(); if (is_array($parameters) && count($parameters)) { $url->setValues($parameters); } return $url->write(); }
/** * Prints current debug output using NewWindowDebugHandlerPrinter * @access public * @return void * @static */ static function printAll($debugPrinter = null) { // ** parameter validation $extendsRule = ExtendsValidatorRule::getRule("DebugHandlerPrinterInterface"); ArgumentValidator::validate($debugPrinter, OptionalRule::getRule($extendsRule), true); // ** end of parameter validation if (is_null($debugPrinter)) { $debugPrinter = new NewWindowDebugHandlerPrinter(); } $debugPrinter->printDebugHandler(Services::getService("Debug")); }
/** * Add a new option to the matrix * * @param string $value * @param string $displayText * @param string $description * @return void * @access public * @since 11/1/07 */ public function addOption($value, $displayText, $description = null) { ArgumentValidator::validate($value, NonZeroLengthStringValidatorRule::getRule()); ArgumentValidator::validate($displayText, NonZeroLengthStringValidatorRule::getRule()); ArgumentValidator::validate($description, OptionalRule::getRule(NonZeroLengthStringValidatorRule::getRule())); $option = new RadioMatrixOption(); $option->value = $value; $option->displayText = $displayText; $option->description = $description; $this->options[] = $option; }
/** * The constructor. * @param ref object $configuration A {@link Properties} Properties with configuration for connection. * @access public * @return void **/ function LDAPConnector($configuration) { $this->_configuration = $configuration; // Validate the configuration options we use: ArgumentValidator::validate($this->_configuration->getProperty('LDAPHost'), FieldRequiredValidatorRule::getRule()); ArgumentValidator::validate($this->_configuration->getProperty('LDAPPort'), OptionalRule::getRule(NumericValidatorRule::getRule())); ArgumentValidator::validate($this->_configuration->getProperty('UserBaseDN'), FieldRequiredValidatorRule::getRule()); ArgumentValidator::validate($this->_configuration->getProperty('ClassesBaseDN'), FieldRequiredValidatorRule::getRule()); ArgumentValidator::validate($this->_configuration->getProperty('GroupBaseDN'), FieldRequiredValidatorRule::getRule()); ArgumentValidator::validate($this->_configuration->getProperty('bindDN'), OptionalRule::getRule(StringValidatorRule::getRule())); ArgumentValidator::validate($this->_configuration->getProperty('bindDNPassword'), OptionalRule::getRule(StringValidatorRule::getRule())); }
/** * Answer a new MediaAsset that wraps the Asset identified with the passed Ids. * * @param string $repositoryId May be null of an empty string. * @param string $assetId * @return object MediaAsset * @access public * @since 4/27/07 * @static */ public static function withIdStrings($repositoryId, $assetId, $recordId) { ArgumentValidator::validate($repositoryId, OptionalRule::getRule(StringValidatorRule::getRule())); ArgumentValidator::validate($assetId, NonZeroLengthStringValidatorRule::getRule()); ArgumentValidator::validate($recordId, NonZeroLengthStringValidatorRule::getRule()); $idManager = Services::getService("Id"); if (!$repositoryId) { $repositoryId = 'edu.middlebury.segue.sites_repository'; } $mediaFile = MediaFile::withIds($idManager->getId($repositoryId), $idManager->getId($assetId), $idManager->getId($recordId)); return $mediaFile; }
/** * Creates a new OracleINSERTQueryResult object. * @access public * @param integer $resourceId The resource id for this query. * @param integer $lastId The last id that was inserted * @return object A new OracleINSERTQueryResult object. */ function OracleInsertQueryResult($resourceId, $lastId) { // ** parameter validation $resourceRule = ResourceValidatorRule::getRule(); $integerRule = OptionalRule::getRule(IntegerValidatorRule::getRule()); ArgumentValidator::validate($resourceId, $resourceRule, true); ArgumentValidator::validate($lastId, $integerRule, true); // ** end of parameter validation $this->_resourceId = $resourceId; $this->_numberOfRows = ocirowcount($this->_resourceId); $this->_lastAutoIncrementValue = $lastId; }
/** * Stores the configuration. Calls the parent configuration first, * then does additional operations. * * @param object Properties $configuration * @return object * @access public * @since 3/24/05 */ function assignConfiguration(Properties $configuration) { parent::assignConfiguration($configuration); // Validate the configuration options we use: ArgumentValidator::validate($this->_configuration->getProperty('properties_fields'), ArrayValidatorRuleWithRule::getRule(StringValidatorRule::getRule())); ArgumentValidator::validate($this->_configuration->getProperty('database_id'), IntegerValidatorRule::getRule()); ArgumentValidator::validate($this->_configuration->getProperty('authentication_table'), StringValidatorRule::getRule()); ArgumentValidator::validate($this->_configuration->getProperty('username_field'), StringValidatorRule::getRule()); ArgumentValidator::validate($this->_configuration->getProperty('password_field'), StringValidatorRule::getRule()); ArgumentValidator::validate($this->_configuration->getProperty('allow_token_addition'), OptionalRule::getRule(BooleanValidatorRule::getRule())); ArgumentValidator::validate($this->_configuration->getProperty('allow_token_deletion'), OptionalRule::getRule(BooleanValidatorRule::getRule())); ArgumentValidator::validate($this->_configuration->getProperty('allow_token_updates'), OptionalRule::getRule(BooleanValidatorRule::getRule())); ArgumentValidator::validate($this->_configuration->getProperty('allow_property_updates'), OptionalRule::getRule(BooleanValidatorRule::getRule())); }
/** * Adds the specified node to the tree and makes it a child of the specified * parent. If the parent is not specified, then it makes the node a root. Always * use this method instead of the addChild() method of the individual tree nodes. * @access public * @param ref object The node to add. * @param optional ref object parent The node that will become the parent of the added node. * @param optional boolean $clearTraversal If true, the tree will clear its * traversal cache. This is needed when changing parentage. * @return void */ function addNode($node, $parent, $clearTraversal = false) { // ** parameter validation $extendsRule = ExtendsValidatorRule::getRule("TreeNode"); $optionalRule = OptionalRule::getRule($extendsRule); ArgumentValidator::validate($node, $extendsRule, true); ArgumentValidator::validate($parent, $optionalRule, true); // ** end of parameter validation $id = $node->getId(); // if node has not been cached then do so if (!$this->nodeExists($id)) { // add the node $this->_nodes[$id] = $node; $this->_size++; } // if $parent is not null, i.e. $node will not be a root if (!is_null($parent)) { // make sure $parent is in the tree if (!$this->nodeExists($parent->getId())) { $str = "Attempted to create a child for a node that is not in the tree."; throwError(new Error($str, "Hierarchy", true)); } // now add $node as a child to $parent $parent->addChild($node); if ($clearTraversal) { // clear the traversal caches as all ancestors of the parent will have // to have their traverse-down caches rebuilt and the child and its // decendents will all need their traverse-up caches rebuilt. // $this->clearTraverseUpCaches($node); // $this->clearTraverseDownCaches($parent); // It appears that selectively clearing the caches is taking // significantly longer to do than just resetting the traversal // caches for all nodes and rebuilding them as needed. // In my tests on 700-Asset Repositories, the following load times // (when checking AZs) were found: // 31.6s clearing all // 32.8s clearing selective // When no AZs were checked, the following load times were found: // 16.5s clearing all // 25.9s clearing selective $this->_traversalCache = array(); } } }
/** * The constructor. * @param string displayName The display name of this menu item. * @param string url The url of this menu item. * @param boolean selected The selected state of this menu item. * @param integer index The index of this component. The index has no semantic meaning: * you can think of the index as 'level' of the component. Alternatively, * the index could serve as means of distinguishing between components with * the same type. Most often one would use the index in conjunction with * the <code>getStylesForComponentType()</code> and * <code>addStyleForComponentType()</code> methods. * @param string target The target window of this menu item. * @param string accessKey The access key (shortcut) of this menu item. * @param string toolTip The toolTip of this menu item. * @access public **/ function MenuItemLink($displayName, $url, $selected, $index, $target = null, $accessKey = null, $toolTip = null) { // ** parameter validation $rule = StringValidatorRule::getRule(); $optionalRule = OptionalRule::getRule($rule); ArgumentValidator::validate($displayName, $rule, true); ArgumentValidator::validate($url, $rule, true); ArgumentValidator::validate($selected, BooleanValidatorRule::getRule(), true); ArgumentValidator::validate($target, $optionalRule, true); ArgumentValidator::validate($accessKey, $optionalRule, true); ArgumentValidator::validate($toolTip, $optionalRule, true); // ** end of parameter validation $this->_displayName = $displayName; $this->_url = $url; $this->_selected = $selected; $this->_target = $target; $this->_accessKey = $accessKey; $this->_toolTip = $toolTip; $this->_attributes = array(); $type = $selected ? MENU_ITEM_LINK_SELECTED : MENU_ITEM_LINK_UNSELECTED; $this->Component(null, $type, $index); }
/** * Constructor -- sets up the allowed fields for this kind of {@link DataContainer} * * @see DataContainer * @access public * @return void */ function HarmoniConfig() { // initialize the data container $this->init(); // add the fields we want to allow $message = "HarmoniConfig - the option 'defaultAction' must be set to a string value!"; $type = "Harmoni"; $this->add("defaultAction", StringValidatorRule::getRule(), $message, $type); $this->add("defaultAction", FieldRequiredValidatorRule::getRule(), $message, $type); unset($message, $type); $message = "HarmoniConfig - the option 'defaultModule' must be set to a string value!"; $type = "Harmoni"; $this->add("defaultModule", StringValidatorRule::getRule(), $message, $type); $this->add("defaultModule", FieldRequiredValidatorRule::getRule(), $message, $type); $message = "HarmoniConfig - if specified, the option 'defaultParams' must be set to a an array of string values!"; $this->add("defaultParams", OptionalRule::getRule(ArrayValidatorRuleWithRule::getRule(StringValidatorRule::getRule())), $message, $type); $this->add("programTitle", StringValidatorRule::getRule(), $message, $type); $this->add("sessionName", FieldRequiredValidatorRule::getRule()); $this->set("sessionName", "Harmoni"); $this->add("sessionUseCookies", BooleanValidatorRule::getRule()); $this->set("sessionUseCookies", true); $this->add("sessionUseOnlyCookies", BooleanValidatorRule::getRule()); $this->set("sessionUseOnlyCookies", true); $this->add("sessionCookiePath", FieldRequiredValidatorRule::getRule()); $this->set("sessionCookiePath", "/"); $this->add("sessionCookieDomain", StringValidatorRule::getRule(), "HarmoniConfig - You must set the 'sessionDomain' to the DNS domain you would like your session cookie sent to! (eg, '.mydomain.com')", "Harmoni"); $this->set("sessionCookieDomain", ""); // default // An array of module.action in which session ids are allowed to be passed in the // url $this->add("sessionInUrlActions", OptionalRule::getRule(ArrayValidatorRuleWithRule::getRule(StringValidatorRule::getRule())), $message, $type); $this->add("sessionCookiesSecure", BooleanValidatorRule::getRule()); $this->set("sessionCookiesSecure", false); $this->add("sessionCookiesHttpOnly", BooleanValidatorRule::getRule()); $this->set("sessionCookiesHttpOnly", true); }
/** * Adds a new condition in the WHERE clause. * * The query will execute only on rows that fulfil the condition. If this method * is never called, then the WHERE clause will not be included. * @param string condition The WHERE clause condition to add. * @param integer logicalOperation The logical operation to use to connect * this WHERE condition with the previous WHERE conditions. Allowed values: * <code>_AND</code> and <code>_OR</code>. * @access public * @return void */ function addWhere($condition, $logicalOperation = _AND) { // ** parameter validation $stringRule = StringValidatorRule::getRule(); $integerRule = IntegerValidatorRule::getRule(); $optionalRule = OptionalRule::getRule($integerRule); ArgumentValidator::validate($condition, $stringRule, true); ArgumentValidator::validate($logicalOperation, $optionalRule, true); // ** end of parameter validation $arr = array(); $arr[] = $condition; $arr[] = $logicalOperation; $this->_condition[] = $arr; }
/** * Adds a new column to the SELECT query. * Adds a new column to the SELECT query. This method is an alternative to the * setColumns() method. It adds one column at a time, and also provides * the ability to explicitly specify the alias of the column to select. * Note: addColumn() and setColumns() can be used together in any order. * However, calling setColumns() after addColumn() resets the list of columns. * @param string $column The name of the column. * @param optional string $alias The alias of the column. * @param optional string $table An optional name of the table where * the column resides. * will be used. * @access public * @see SelectQueryInterface::setColumns() */ function addColumn($column, $alias = "", $table = "") { // ** parameter validation $stringRule = StringValidatorRule::getRule(); $optionalRule = OptionalRule::getRule($stringRule); ArgumentValidator::validate($column, $stringRule, true); ArgumentValidator::validate($alias, $optionalRule, true); ArgumentValidator::validate($table, $optionalRule, true); // ** end of parameter validation if ($table) { $correlationName = $table; } else { $correlationName = null; } if ($alias) { $cols = array($column . " AS " . $alias); } else { $cols = array($column); } $this->_tableCols($correlationName, $cols); }
/** * Import a SiteComponent defined by an XML element * * @param object DOMElement $element * @param optional object SiteComponent $parentComponent This should only be NULL for sites * @return object SiteComponent * @access protected * @since 1/22/08 */ protected function createComponent(DOMElement $element, $parentComponent = null) { ArgumentValidator::validate($parentComponent, OptionalRule::getRule(ExtendsValidatorRule::getRule('SiteComponent'))); if (is_null($parentComponent) && $element->nodeName != 'SiteNavBlock') { throw new Exception('Only SiteNavBlocks can have no parentComponent passed'); } if ($element->nodeName == 'Block') { $component = $this->director->createSiteComponent(new Type($this->getSingleNode("./type/domain/text()", $element)->nodeValue, $this->getSingleNode("./type/authority/text()", $element)->nodeValue, $this->getSingleNode("./type/keyword/text()", $element)->nodeValue), $parentComponent); } else { $component = $this->director->createSiteComponent(new Type('segue', 'edu.middlebury', $element->nodeName), $parentComponent); } if (isset($this->status)) { $this->status->updateStatistics(); } return $component; }
/** * Duplicate a RecordStructure, optionally duplicating the records as well, * also optionally deleting the records in the original RecordStructure. * * Use this method to convert from data stored in a 'global' RecordStructure * such as DublinCore into a 'local' version of the RecordStructure Core in which the * user has the option of customizing fields. * * As well, this method can be used to convert a RecordStructure and associated * Records to a local version if the RecordStructure was accidentally created * as a 'global' one. * * WARNING: NOT IN OSID * * @param object Id $recordStructureId The id of the RecordStructure to duplicate * @param boolean $copyRecords If true, existing records will be duplicated * under the new RecordStructure. * @param optional object $id An optional id for the new RecordStructure * @param optional boolean $isGlobal If true the new RecordStructure will be made a global one. * @param optional object $statusStars A status indicator to use if passed. * @return void * @access public * @since 6/7/06 */ function duplicateRecordStructure(Id $recordStructureId, $copyRecords = FALSE, $id = null, $isGlobal = FALSE, $statusStars = null) { ArgumentValidator::validate($recordStructureId, ExtendsValidatorRule::getRule("Id")); ArgumentValidator::validate($copyRecords, BooleanValidatorRule::getRule()); ArgumentValidator::validate($id, OptionalRule::getRule(ExtendsValidatorRule::getRule("Id"))); ArgumentValidator::validate($isGlobal, BooleanValidatorRule::getRule()); $oldRecStruct = $this->getRecordStructure($recordStructureId); $newRecStruct = $this->createRecordStructure($oldRecStruct->getDisplayName() . _(" Copy"), $oldRecStruct->getDescription(), $oldRecStruct->getFormat(), $oldRecStruct->getSchema(), $id, $isGlobal); $mapping = array(); $oldPartStructs = $oldRecStruct->getPartStructures(); while ($oldPartStructs->hasNext()) { $oldPartStruct = $oldPartStructs->next(); $newPartStruct = $newRecStruct->createPartStructure($oldPartStruct->getDisplayName(), $oldPartStruct->getDescription(), $oldPartStruct->getType(), $oldPartStruct->isMandatory(), $oldPartStruct->isRepeatable(), $oldPartStruct->isPopulatedByRepository()); // Mapping $oldPartStructId = $oldPartStruct->getId(); $mapping[$oldPartStructId->getIdString()] = $newPartStruct->getId(); } unset($oldPartStruct, $newPartStruct); if ($copyRecords) { $assets = $this->getAssets(); if (!is_null($statusStars)) { $statusStars->initializeStatistics($assets->count()); } while ($assets->hasNext()) { $asset = $assets->next(); $oldRecords = $asset->getRecordsByRecordStructure($oldRecStruct->getId()); while ($oldRecords->hasNext()) { $oldRecord = $oldRecords->next(); // Create the new Record $newRecord = $asset->createRecord($newRecStruct->getId()); $oldParts = $oldRecord->getParts(); while ($oldParts->hasNext()) { $oldPart = $oldParts->next(); $oldPartStruct = $oldPart->getPartStructure(); $oldPartStructId = $oldPartStruct->getId(); $newPart = $newRecord->createPart($mapping[$oldPartStructId->getIdString()], $oldPart->getValue()); } } if (!is_null($statusStars)) { $statusStars->updateStatistics(); } } } return $newRecStruct; }
/** * The constructor. * @access public * @param string content This is an arbitrary string that will be printed, * whenever the user calls the <code>render()</code> method. If <code>null</code>, * then the component will have no content. * @param integer type The type of this component. One of BLANK, HEADING, HEADER, FOOTER, * BLOCK, MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER. * @param integer index The index of this component. The index has no semantic meaning: * you can think of the index as 'level' of the component. Alternatively, * the index could serve as means of distinguishing between components with * the same type. Most often one would use the index in conjunction with * the <code>getStylesForComponentType()</code> and * <code>addStyleForComponentType()</code> methods. * @param optional object StyleCollections styles,... Zero, one, or more StyleCollection * objects that will be added to the newly created Component. Warning, this will * result in copying the objects instead of referencing them as using * <code>addStyle()</code> would do. **/ function Component($content, $type, $index) { // ** parameter validation $rule = OptionalRule::getRule(StringValidatorRule::getRule()); ArgumentValidator::validate($content, $rule, true); $rule = ChoiceValidatorRule::getRule(BLANK, HEADING, HEADER, FOOTER, BLOCK, MENU, SUB_MENU, MENU_ITEM_LINK_UNSELECTED, MENU_ITEM_LINK_SELECTED, MENU_ITEM_HEADING, OTHER); ArgumentValidator::validate($type, $rule, true); ArgumentValidator::validate($index, IntegerValidatorRule::getRule(), true); // ** end of parameter validation $this->_content = $content; $this->_styleCollections = array(); $this->_type = $type; $this->_index = $index; // if there are style collections to add if (func_num_args() > 3) { for ($i = 3; $i < func_num_args(); $i++) { $this->addStyle(func_get_arg($i)); } } }
/** * Given a functionId and a qualifierId returns the Ids of all Agents * allowed to do the Function with the Qualifier. A null qualifierId is * treated as a wildcard. * * @param object Id $functionId * @param object Id $qualifierId * * @return object IdIterator * * @throws object AuthorizationException An exception with * one of the following messages defined in * org.osid.authorization.AuthorizationException may be thrown: * {@link * org.osid.authorization.AuthorizationException#OPERATION_FAILED * OPERATION_FAILED}, {@link * org.osid.authorization.AuthorizationException#PERMISSION_DENIED * PERMISSION_DENIED}, {@link * org.osid.authorization.AuthorizationException#CONFIGURATION_ERROR * CONFIGURATION_ERROR}, {@link * org.osid.authorization.AuthorizationException#UNIMPLEMENTED * UNIMPLEMENTED}, {@link * org.osid.authorization.AuthorizationException#NULL_ARGUMENT * NULL_ARGUMENT}, {@link * org.osid.authorization.AuthorizationException#UNKNOWN_ID * UNKNOWN_ID} * * @access public */ function getWhoCanDo(Id $functionId = null, Id $qualifierId = null) { // ** parameter validation ArgumentValidator::validate($functionId, ExtendsValidatorRule::getRule("Id"), true); ArgumentValidator::validate($qualifierId, OptionalRule::getRule(ExtendsValidatorRule::getRule("Id")), true); // Removed as of version 2 of the OSID // ArgumentValidator::validate($isActiveNow, BooleanValidatorRule::getRule(), true); // ** end of parameter validation $authorizations = $this->getAllAZs($null = null, $functionId, $qualifierId, true); $agentIds = array(); while ($authorizations->hasNext()) { $authorization = $authorizations->next(); $agentId = $authorization->getAgentId(); if (!isset($agentIds[$agentId->getIdString()])) { $agentIds[$agentId->getIdString()] = $agentId; } } $i = new HarmoniIdIterator($agentIds); return $i; }
/** * Assign the configuration of this Manager. Valid configuration options are as * follows: * database_index integer * database_name string * * @param object Properties $configuration (original type: java.util.Properties) * * @throws object OsidException An exception with one of the following * messages defined in org.osid.OsidException: {@link * org.osid.OsidException#OPERATION_FAILED OPERATION_FAILED}, * {@link org.osid.OsidException#PERMISSION_DENIED * PERMISSION_DENIED}, {@link * org.osid.OsidException#CONFIGURATION_ERROR * CONFIGURATION_ERROR}, {@link * org.osid.OsidException#UNIMPLEMENTED UNIMPLEMENTED}, {@link * org.osid.OsidException#NULL_ARGUMENT NULL_ARGUMENT} * * @access public */ function assignConfiguration(Properties $configuration) { $this->_configuration = $configuration; $dbIndex = $configuration->getProperty('database_index'); $prefix = $configuration->getProperty('id_prefix'); // ** parameter validation ArgumentValidator::validate($dbIndex, IntegerValidatorRule::getRule(), true); ArgumentValidator::validate($prefix, OptionalRule::getRule(StringValidatorRule::getRule(), true)); // ** end of parameter validation $this->_dbIndex = $dbIndex; if ($prefix) { $this->_prefix = $prefix; } $harmoni_db_name = $this->_configuration->getProperty('harmoni_db_name'); if (!is_null($harmoni_db_name)) { try { $this->harmoni_db = Harmoni_Db::getDatabase($harmoni_db_name); $this->setUpStatements(); } catch (UnknownIdException $e) { } } }
/** * Adds the given StyleProperty to the internally maintained list of mutable * (updateable) style properties and assigns it an id. This method and * the <code>getRegisteredSP</code> method enable the user to quickly change * the values of key Theme settings. For example, * let us assume that Bob has created his own theme and he has added a global * style collection for the main content block. Bob would like to allow the * user to change the width property of that collection. In order to do so, * Bob needs to call <code>registerSP()</code> and pass the WidthSP * object accordingly. This WidthSP object must be the same object that had * been added to the aforementioned global style collection. The user now can * call <code>getRegisteredSP</code> with the id that was returned by * <code>registerSP</code> and access/modify the <code>WidthSP</code> object. * @access public * @param ref object sp The StyleProperty object that will be registered as * mutable within this Theme. * @param optional string postImportMethod This is the name of the method that will * be called after this SP is imported (an optional argument). This can be useful in case other * properties depend on the content of this property, but the user does not * to export all of them. * @return integer An integer id assigned to the given style property. The id * only meaningful within the context of this Theme (i.e. this is not a system wide unique id). **/ function registerSP($sp, $postImportMethod = NULL) { // ** parameter validation $rule = ExtendsValidatorRule::getRule("StylePropertyInterface"); ArgumentValidator::validate($sp, $rule, true); $rule = OptionalRule::getRule(StringValidatorRule::getRule()); ArgumentValidator::validate($postImportMethod, $rule, true); // ** end of parameter validation $this->_registeredSPs[] = $sp; $id = count($this->_registeredSPs) - 1; if (isset($postImportMethod)) { $this->_postImportMethods[$id] = $postImportMethod; } return $id; }
/** * Auxilliary private function that returns Authorizations according to a * criteria. Null values are interpreted as wildmarks. Warning: $returnExplicitOnly = false * will increase the running time significantly - USE SPARINGLY! * @access public * @param string aId The string id of an agent. * @param string fId The string id of a function. * @param string qId The string id of a qualifier. This parameter can not be null * and used as a wildmark. * @param object fType The type of a function. * @param boolean returnExplicitOnly If True, only explicit Authorizations * will be returned. * @param boolean searchUp If true, the ancester nodes of the qualifier will * be checked as well * @param boolean isActiveNow If True, only active Authorizations will be returned. * @return ref object An AuthorizationIterator. **/ function getAZs($aId, $fId, $qId, $fType, $returnExplicitOnly, $searchUp, $isActiveNow, $groupIds = array()) { // printpre (func_get_args()); // ** parameter validation $rule = StringValidatorRule::getRule(); ArgumentValidator::validate($groupIds, ArrayValidatorRuleWithRule::getRule(OptionalRule::getRule($rule)), true); ArgumentValidator::validate($aId, OptionalRule::getRule($rule), true); ArgumentValidator::validate($fId, OptionalRule::getRule($rule), true); ArgumentValidator::validate($qId, OptionalRule::getRule($rule), true); ArgumentValidator::validate($fType, OptionalRule::getRule(ExtendsValidatorRule::getRule("Type")), true); ArgumentValidator::validate($returnExplicitOnly, BooleanValidatorRule::getRule(), true); ArgumentValidator::validate($isActiveNow, BooleanValidatorRule::getRule(), true); // ** end of parameter validation $idManager = Services::getService("Id"); // the parameter that influences the result most is $returnExplicitOnly // 1) If $returnExplicitOnly is TRUE, then we only need to check for Authorizations // that have been explicitly created, i.e. no need to look for inherited // authorizations // 2) If $returnExplicitOnly is FALSE, then we need to include inherited Authorizations // as well. // this array will store the ids of all qualifiers to be checked for authorizations $qualifiers = array(); // check all ancestors of given qualifier $hierarchyManager = Services::getService("Hierarchy"); if (isset($qId)) { $qualifierId = $idManager->getId($qId); $node = $hierarchyManager->getNode($qualifierId); $hierarchy = $hierarchyManager->getHierarchyForNode($node); if ($searchUp) { // these are the ancestor nodes $nodes = $hierarchy->traverse($qualifierId, Hierarchy::TRAVERSE_MODE_DEPTH_FIRST, Hierarchy::TRAVERSE_DIRECTION_UP, Hierarchy::TRAVERSE_LEVELS_ALL); // now get the id of each node and store in array while ($nodes->hasNext()) { $info = $nodes->next(); $id = $info->getNodeId(); $qualifiers[] = $id->getIdString(); } } else { $qualifiers = array($qId); } } // print_r($qualifiers); // setup the query $dbHandler = Services::getService("DatabaseManager"); $query = new SelectQuery(); $query->addColumn("authorization_id", "id"); $query->addColumn("fk_agent", "aid"); $query->addColumn("fk_function", "fid"); $query->addColumn("fk_qualifier", "qid"); $query->addColumn("authorization_effective_date", "eff_date"); $query->addColumn("authorization_expiration_date", "exp_date"); $query->addTable("az_authorization"); // now include criteria // the qualifiers criteria if (isset($qualifiers) && count($qualifiers)) { $query->addWhereIn('az_authorization.fk_qualifier', $qualifiers); } // Agents/Groups if (isset($aId)) { $agentIds = array($aId); } else { $agentIds = array(); } $allAgentIds = array_merge($agentIds, $groupIds); // the agent criteria if (count($allAgentIds)) { $query->addWhereIn('az_authorization.fk_agent', $allAgentIds); } // the function criteria if (isset($fId)) { $joinc = "az_authorization.fk_function = az_function.function_id"; $query->addTable("az_function", INNER_JOIN, $joinc); $query->addWhereEqual("az_authorization.fk_function", $fId); } // the function type criteria if (isset($fType)) { // do not join with az_function if we did already if (!isset($fId)) { $joinc = "az_authorization.fk_function = az_function.function_id"; $query->addTable("az_function", INNER_JOIN, $joinc); } // now join with type $joinc = "az_function.fk_type = type.type_id"; $query->addTable("type", INNER_JOIN, $joinc); $query->addWhereEqual("type.type_domain", $fType->getDomain()); $query->addWhereEqual("type.type_authority", $fType->getAuthority()); $query->addWhereEqual("type.type_keyword", $fType->getKeyword()); } // the isActiveNow criteria if ($isActiveNow) { $where = "(authorization_effective_date IS NULL OR (NOW() >= authorization_effective_date))"; $query->addWhere($where); $where = "(authorization_expiration_date IS NULL OR (NOW() < authorization_expiration_date))"; $query->addWhere($where); } $query->addOrderBy("authorization_id"); // echo "<pre>\n"; // echo MySQL_SQLGenerator::generateSQLQuery($query); // echo "</pre>\n"; $queryResult = $dbHandler->query($query, $this->_dbIndex); // this array will store the authorizations that will be returned $authorizations = array(); // we only want to create one implicitAZ for a given Agent/Function/Qualifier // combo, so maintain a list of already created ones to skip $createdImplicitAZs = array(); $i = 0; // process all rows and create the explicit authorizations while ($queryResult->hasMoreRows()) { $row = $queryResult->getCurrentRow(); // printpre($row); $idValue = $row['id']; $id = $idManager->getId($idValue); if (isset($this->_authorizations[$idValue])) { $authorization = $this->_authorizations[$idValue]; } else { $agentId = $idManager->getId($row['aid']); $functionId = $idManager->getId($row['fid']); $explicitQualifierId = $idManager->getId($row['qid']); $effectiveDate = $dbHandler->fromDBDate($row['eff_date'], $this->_dbIndex); $expirationDate = $dbHandler->fromDBDate($row['exp_date'], $this->_dbIndex); // create the explicit authorization (each explicit authorization // has a corresponding row in the authorization db table) $authorization = new HarmoniAuthorization($idValue, $agentId, $functionId, $explicitQualifierId, true, $this, $effectiveDate, $expirationDate); $this->_authorizations[$idValue] = $authorization; } // Explicit AZ for ancestor qualifiers and groups should have // corresponding implicit AZs // in decendents, but not appear in their AZs directly. // Therefore, only add the explicit AZ if it is for the requested // qualifier and agent if we are fetching more than just the explicitAZs. if ($row['qid'] == $qId && $row['aid'] == $aId || $returnExplicitOnly) { $authorizations[] = $authorization; } // now create the implicit authorizations // the implicit authorizations will be created for all nodes // on the hierarchy path(s) between the node with the explicit authorization // and the node on which getAZs() was called. // If the row's qualifier and agent are what we asked for however, // then the AZ is explicit and doesn't need an implicit AZ as well. if ((!$returnExplicitOnly || $searchUp) && ($row['qid'] != $qId || $aId && $row['aid'] != $aId)) { // printpre("Building Implicit AZs..."); // var_dump($returnExplicitOnly); // var_dump($searchUp); // if this is an AZ that is implicit because of a group instead // of because of the hierarchy, create it. if ($row['qid'] == $qId && $row['aid'] != $aId) { // printpre("In first clause (AuthorizationCache)"); $qualifierId = $idManager->getId($qId); // If we are getting implicit AZs for a given agent, make sure // that the implicit AZ has their Id. if ($aId) { $agentId = $idManager->getId($aId); } else { $agentId = $authorization->getAgentId(); } $function = $authorization->getFunction(); $functionId = $function->getId(); $effectiveDate = $authorization->getEffectiveDate(); $expirationDate = $authorization->getExpirationDate(); $implicit = new HarmoniAuthorization(null, $agentId, $functionId, $qualifierId, false, $this, $effectiveDate, $expirationDate); $azHash = $agentId->getIdString() . "::" . $functionId->getIdString() . "::" . $qualifierId->getIdString(); if (!in_array($azHash, $createdImplicitAZs)) { $authorizations[] = $implicit; $createdImplicitAZs[] = $azHash; } } else { if (!$returnExplicitOnly && $qId) { // printpre("In second clause (AuthorizationCache)"); // If we are getting implicit AZs for a given agent, make sure // that the implicit AZ has their Id. if ($aId) { $agentId = $idManager->getId($aId); } else { $agentId = $authorization->getAgentId(); } $function = $authorization->getFunction(); $functionId = $function->getId(); $effectiveDate = $authorization->getEffectiveDate(); $expirationDate = $authorization->getExpirationDate(); $implicitQualifierId = $idManager->getId($qId); $implicit = new HarmoniAuthorization(null, $agentId, $functionId, $implicitQualifierId, false, $this, $effectiveDate, $expirationDate); $azHash = $agentId->getIdString() . "::" . $functionId->getIdString() . "::" . $implicitQualifierId->getIdString(); if (!in_array($azHash, $createdImplicitAZs)) { $authorizations[] = $implicit; $createdImplicitAZs[] = $azHash; } } else { if (!$returnExplicitOnly) { printpre($row); printpre("In third clause (AuthorizationCache)"); $explicitQualifier = $authorization->getQualifier(); $explicitQualifierId = $explicitQualifier->getId(); // If we are getting implicit AZs for a given agent, make sure // that the implicit AZ has their Id. if ($aId) { $agentId = $idManager->getId($aId); } else { $agentId = $authorization->getAgentId(); } $function = $authorization->getFunction(); $functionId = $function->getId(); $effectiveDate = $authorization->getEffectiveDate(); $expirationDate = $authorization->getExpirationDate(); // this is set 2 $authZManager = Services::getService("AuthZ"); $hierarchies = $authZManager->getQualifierHierarchies(); while ($hierarchies->hasNext()) { $hierarchyId = $hierarchies->next(); $hierarchy = $hierarchyManager->getHierarchy($hierarchyId); $timer = new Timer(); $timer->start(); $nodes = $hierarchy->traverse($explicitQualifierId, Hierarchy::TRAVERSE_MODE_DEPTH_FIRST, Hierarchy::TRAVERSE_DIRECTION_DOWN, Hierarchy::TRAVERSE_LEVELS_ALL); $timer->end(); printf("LoadAZTime: %1.6f <br/>", $timer->printTime()); // now get the id of each node and store in array $set2 = array(); // skip the first node $nodes->next(); while ($nodes->hasNext()) { $info = $nodes->next(); $nodeId = $info->getNodeId(); $implicit = new HarmoniAuthorization(null, $agentId, $functionId, $nodeId, false, $this, $effectiveDate, $expirationDate); $azHash = $agentId->getIdString() . "::" . $functionId->getIdString() . "::" . $nodeId->getIdString(); // printpre($azHash); // Weird bugs were happening, with $createdImplicitAZs // but I can't figure out what is going on. if (!in_array($azHash, $createdImplicitAZs)) { $authorizations[] = $implicit; // $createdImplicitAZs[] = $azHash; } } } } } } } $queryResult->advanceRow(); } $queryResult->free(); return $authorizations; }
/** * Update the date at which this Asset expires. * * @param object DateAndTime $expirationDate * * @throws object RepositoryException An exception with one of * the following messages defined in * org.osid.repository.RepositoryException may be thrown: {@link * org.osid.repository.RepositoryException#OPERATION_FAILED * OPERATION_FAILED}, {@link * org.osid.repository.RepositoryException#PERMISSION_DENIED * PERMISSION_DENIED}, {@link * org.osid.repository.RepositoryException#CONFIGURATION_ERROR * CONFIGURATION_ERROR}, {@link * org.osid.repository.RepositoryException#UNIMPLEMENTED * UNIMPLEMENTED}, {@link * org.osid.repository.RepositoryException#NULL_ARGUMENT * NULL_ARGUMENT}, {@link * org.osid.repository.RepositoryException#EFFECTIVE_PRECEDE_EXPIRATION} * * @access public */ function updateExpirationDate($expirationDate) { ArgumentValidator::validate($expirationDate, OptionalRule::getRule(HasMethodsValidatorRule::getRule("asDateAndTime"))); // Make sure that we have dates from the DB if they exist. $this->_loadDates(); // Update our date in preparation for DB updating $this->_expirationDate = $expirationDate; // Store the dates $this->_storeDates(); }
/** * Create a Hierarchy. * * @param string $displayName * @param object Type[] $nodeTypes * @param string $description * @param boolean $allowsMultipleParents * @param boolean $allowsRecursion * @param optional object Id $id WARNING: NOT IN OSID * * @return object Hierarchy * * @throws object HierarchyException An exception with one of * the following messages defined in * org.osid.hierarchy.HierarchyException may be thrown: {@link * org.osid.hierarchy.HierarchyException#OPERATION_FAILED * OPERATION_FAILED}, {@link * org.osid.hierarchy.HierarchyException#PERMISSION_DENIED * PERMISSION_DENIED}, {@link * org.osid.hierarchy.HierarchyException#CONFIGURATION_ERROR * CONFIGURATION_ERROR}, {@link * org.osid.hierarchy.HierarchyException#UNIMPLEMENTED * UNIMPLEMENTED}, {@link * org.osid.hierarchy.HierarchyException#NULL_ARGUMENT * NULL_ARGUMENT}, {@link * org.osid.hierarchy.HierarchyException#UNSUPPORTED_CREATION * UNSUPPORTED_CREATION} * * @access public */ function createHierarchy($displayName, array $nodeTypes, $description, $allowsMultipleParents, $allowsRecursion, Id $id = NULL) { // ** parameter validation ArgumentValidator::validate($description, StringValidatorRule::getRule(), true); ArgumentValidator::validate($displayName, StringValidatorRule::getRule(), true); ArgumentValidator::validate($allowsMultipleParents, BooleanValidatorRule::getRule(), true); ArgumentValidator::validate($allowsRecursion, BooleanValidatorRule::getRule(), true); ArgumentValidator::validate($id, OptionalRule::getRule(ExtendsValidatorRule::getRule("Id")), true); // ** end of parameter validation // check for supported hierarchies if ($allowsRecursion) { throw new OperationFailedException("Unsuported creation. Does not support recursion."); } $dbHandler = Services::getService("DatabaseManager"); // Create an Id for the Hierarchy if (!is_object($id)) { $idManager = Services::getService("Id"); $id = $idManager->createId(); } $idValue = $id->getIdString(); $query = new InsertQuery(); $query->setTable("az2_hierarchy"); $query->addValue("id", $idValue); $query->addValue("display_name", $displayName); $query->addValue("description", $description); $query->addValue("multiparent", $allowsMultipleParents ? '1' : '0'); $queryResult = $dbHandler->query($query, $this->_dbIndex); // Create a new hierarchy and insert it into the database $cache = new AuthZ2_HierarchyCache($idValue, $allowsMultipleParents, $this->_dbIndex, isset($this->harmoni_db) ? $this->harmoni_db : null); $cache->setAuthorizationManager($this->getAuthorizationManager()); $hierarchy = new AuthZ2_Hierarchy($id, $displayName, $description, $cache); // then cache it $this->_hierarchies[$idValue] = $hierarchy; return $hierarchy; }
/** * Optional: Specifies a GIF, JPEG or PNG image that can be displayed with the channel. * * @param string $imageURL * @param string $imageTitle * @return void * @access public * @since 8/7/06 */ function setImage($imageURL, $imageHeight = null, $imageWidth = null, $imageTitle = null, $imageLink = null, $imageDescription = null) { ArgumentValidator::validate($imageURL, StringValidatorRule::getRule()); ArgumentValidator::validate($imageHeight, OptionalRule::getRule(IntegerValidatorRule::getRule())); ArgumentValidator::validate($imageHeight, OptionalRule::getRule(IntegerRangeValidatorRule::getRule(1, 400))); ArgumentValidator::validate($imageWidth, OptionalRule::getRule(IntegerValidatorRule::getRule())); ArgumentValidator::validate($imageWidth, OptionalRule::getRule(IntegerRangeValidatorRule::getRule(1, 144))); ArgumentValidator::validate($imageLink, OptionalRule::getRule(StringValidatorRule::getRule())); ArgumentValidator::validate($imageDescription, OptionalRule::getRule(StringValidatorRule::getRule())); $this->_imageURL = $imageURL; if ($imageTitle) { $this->_imageTitle = $imageTitle; } if ($imageLink) { $this->_imageLink = $imageLink; } if ($imageDescription) { $this->_imageDescription = $imageDescription; } if ($imageHeight) { $this->_imageHeight = $imageHeight; } if ($imageWidth) { $this->_imageWidth = $imageWidth; } }
/** * Assign the configuration of this Manager. Valid configuration options are as * follows: * database_index integer * database_name string * * @param object Properties $configuration (original type: java.util.Properties) * * @throws object OsidException An exception with one of the following * messages defined in org.osid.OsidException: {@link * org.osid.OsidException#OPERATION_FAILED OPERATION_FAILED}, * {@link org.osid.OsidException#PERMISSION_DENIED * PERMISSION_DENIED}, {@link * org.osid.OsidException#CONFIGURATION_ERROR * CONFIGURATION_ERROR}, {@link * org.osid.OsidException#UNIMPLEMENTED UNIMPLEMENTED}, {@link * org.osid.OsidException#NULL_ARGUMENT NULL_ARGUMENT} * * @access public */ function assignConfiguration(Properties $configuration) { $this->_configuration = $configuration; $dbIndex = $configuration->getProperty('database_index'); $hierarchyIdString = $configuration->getProperty('hierarchy_id'); $defaultParentIdString = $configuration->getProperty('default_parent_id'); // ** parameter validation ArgumentValidator::validate($dbIndex, IntegerValidatorRule::getRule(), true); ArgumentValidator::validate($hierarchyIdString, StringValidatorRule::getRule(), true); ArgumentValidator::validate($defaultParentIdString, OptionalRule::getRule(StringValidatorRule::getRule()), true); // ** end of parameter validation $this->_dbIndex = $dbIndex; // Set up our hierarchy $hierarchyManager = Services::getService("Hierarchy"); $idManager = Services::getService("Id"); $hierarchyId = $idManager->getId($hierarchyIdString); $this->_hierarchy = $hierarchyManager->getHierarchy($hierarchyId); // Record what parent to store newly created repositories under if ($defaultParentIdString) { $this->_defaultParentId = $idManager->getId($defaultParentIdString); } else { $this->_defaultParentId = NULL; } }
/** * Insert a component at the place of a predefined placeholder that had * been created with addPlaceholder(). * * @param integer $placeholderId * @param ref object component The component to add. * @param string width The available width for the added component. If null, will be ignored. * @param string height The available height for the added component. If null, will be ignored. * @param integer alignmentX The horizontal alignment for the added component. Allowed values are * <code>LEFT</code>, <code>CENTER</code>, and <code>RIGHT</code>. * If null, will be ignored. * @param integer alignmentY The vertical alignment for the added component. Allowed values are * <code>TOP</code>, <code>CENTER</code>, and <code>BOTTOM</code>. * If null, will be ignored. * @return ref object The component that was just inserted. * @access public * @since 1/24/07 */ function insertAtPlaceholder($placeholderId, $component, $width = NULL, $height = NULL, $alignmentX = NULL, $alignmentY = NULL) { // ** parameter validation ArgumentValidator::validate($placeholderId, IntegerValidatorRule::getRule(), true); ArgumentValidator::validate($component, ExtendsValidatorRule::getRule("ComponentInterface"), true); ArgumentValidator::validate($width, OptionalRule::getRule(StringValidatorRule::getRule(), true)); ArgumentValidator::validate($height, OptionalRule::getRule(StringValidatorRule::getRule(), true)); ArgumentValidator::validate($alignmentX, OptionalRule::getRule(IntegerValidatorRule::getRule(), true)); ArgumentValidator::validate($alignmentY, OptionalRule::getRule(IntegerValidatorRule::getRule(), true)); // ** end of parameter validation if (!in_array($placeholderId, $this->_placeholders)) { throwError(new Error("Unknown placeholder id, '" . $placeholderId . "'.", "GUIManager")); } $constraint = array(); $constraint[0] = $width; $constraint[1] = $height; $constraint[2] = $alignmentX; $constraint[3] = $alignmentY; $this->_constraints[$placeholderId - 1] = $constraint; // Add any pre and post html that was added to the placeholder $null = null; $component->setPreHTML($this->_components[$placeholderId - 1]->getPreHTML($null) . $component->getPreHTML($null)); $component->setPostHTML($component->getPostHTML($null) . $this->_components[$placeholderId - 1]->getPostHTML($null)); // Replace the placeholder with the component $this->_components[$placeholderId - 1] = $component; return $this->_components[$placeholderId - 1]; }
/** * Auxilliary private function that returns Authorizations according to a * criteria. Null values are interpreted as wildmarks. Warning: $returnExplicitOnly = false * will increase the running time significantly - USE SPARINGLY! * @access public * @param string aId The string id of an agent. * @param string fId The string id of a function. * @param string qId The string id of a qualifier. This parameter can not be null * and used as a wildmark. * @param object fType The type of a function. * @param boolean returnExplicitOnly If True, only explicit Authorizations * will be returned. * @param boolean isActiveNow If True, only active Authorizations will be returned. * @return array **/ function getAZs($aId, $fId, $qId, $fType, $returnExplicitOnly, $isActiveNow, $groupIds = array()) { // printpre (func_get_args()); // ** parameter validation $rule = StringValidatorRule::getRule(); ArgumentValidator::validate($groupIds, ArrayValidatorRuleWithRule::getRule(OptionalRule::getRule($rule)), true); ArgumentValidator::validate($aId, OptionalRule::getRule($rule), true); ArgumentValidator::validate($fId, OptionalRule::getRule($rule), true); ArgumentValidator::validate($qId, OptionalRule::getRule($rule), true); ArgumentValidator::validate($fType, OptionalRule::getRule(ExtendsValidatorRule::getRule("Type")), true); ArgumentValidator::validate($returnExplicitOnly, BooleanValidatorRule::getRule(), true); ArgumentValidator::validate($isActiveNow, BooleanValidatorRule::getRule(), true); // ** end of parameter validation $idManager = Services::getService("Id"); // the parameter that influences the result most is $returnExplicitOnly // 1) If $returnExplicitOnly is TRUE, then we only need to check for Authorizations // that have been explicitly created, i.e. no need to look for inherited // authorizations // 2) If $returnExplicitOnly is FALSE, then we need to include inherited Authorizations // as well. // Agents/Groups if (isset($aId)) { $agentIds = array($aId); } else { $agentIds = array(); } $allAgentIds = array_merge($agentIds, $groupIds); $explicitQueryResult = $this->getExplicitAZQueryResult($allAgentIds, $fId, $qId, $fType, $isActiveNow); if ($returnExplicitOnly) { return $this->getAuthorizationsFromQueryResult($explicitQueryResult, $aId, $qId, $returnExplicitOnly); } else { $implicitQueryResult = $this->getImplicitAZQueryResult($allAgentIds, $fId, $qId, $fType, $isActiveNow); return array_merge($this->getAuthorizationsFromQueryResult($explicitQueryResult, $aId, $qId, $returnExplicitOnly), $this->getAuthorizationsFromQueryResult($implicitQueryResult, $aId, $qId, $returnExplicitOnly)); } }