/**
  * Short description of method remove
  *
  * @access public
  * @author Jehan Bihin, <*****@*****.**>
  * @param  string roleUri
  * @param  string accessUri
  * @return mixed
  */
 public function remove($roleUri, $accessUri)
 {
     $uri = explode('#', $accessUri);
     list($type, $extId) = explode('_', $uri[1]);
     // Remove the access to the extension for this role.
     $extManager = common_ext_ExtensionsManager::singleton();
     $extension = $extManager->getExtensionById($extId);
     $role = new core_kernel_classes_Resource($roleUri);
     $role->removePropertyValues(new core_kernel_classes_Property(PROPERTY_ACL_GRANTACCESS), array('pattern' => $accessUri));
     funcAcl_helpers_Cache::flushExtensionAccess($extId);
     // also remove access to all the controllers
     $moduleAccessProperty = new core_kernel_classes_Property(PROPERTY_ACL_GRANTACCESS);
     $moduleAccessService = funcAcl_models_classes_ModuleAccessService::singleton();
     $grantedModules = $role->getPropertyValues($moduleAccessProperty);
     foreach ($grantedModules as $gM) {
         $gM = new core_kernel_classes_Resource($gM);
         $uri = explode('#', $gM->getUri());
         list($type, $ext) = explode('_', $uri[1]);
         if ($extId == $ext) {
             $moduleAccessService->remove($role->getUri(), $gM->getUri());
         }
     }
 }
 /**
  * Short description of method deleteConnectorNextActivity
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  Resource connector
  * @param  string connectionType
  * @return mixed
  */
 public function deleteConnectorNextActivity(core_kernel_classes_Resource $connector, $connectionType = 'next')
 {
     $nextActivitiesProp = new core_kernel_classes_Property(PROPERTY_STEP_NEXT);
     $connectorService = wfEngine_models_classes_ConnectorService::singleton();
     switch ($connectionType) {
         case 'next':
             $property = $nextActivitiesProp;
             break;
         case 'then':
             $property = new core_kernel_classes_Property(PROPERTY_TRANSITIONRULES_THEN);
             break;
         case 'else':
             $property = new core_kernel_classes_Property(PROPERTY_TRANSITIONRULES_ELSE);
             break;
         default:
             throw new Exception('Trying to delete the value of an unauthorized connector property');
     }
     $activityRefProp = new core_kernel_classes_Property(PROPERTY_CONNECTORS_ACTIVITYREFERENCE);
     $activityRef = $connector->getUniquePropertyValue($activityRefProp)->getUri();
     if ($property->getUri() == PROPERTY_STEP_NEXT) {
         //manage the connection to the following activities
         $nextActivityCollection = $connector->getPropertyValuesCollection($property);
         foreach ($nextActivityCollection->getIterator() as $nextActivity) {
             if ($connectorService->isConnector($nextActivity)) {
                 $nextActivityRef = $nextActivity->getUniquePropertyValue($activityRefProp)->getUri();
                 if ($nextActivityRef == $activityRef) {
                     //delete following connectors only if they have the same activity reference
                     wfAuthoring_models_classes_ConnectorService::singleton()->delete($nextActivity);
                 }
             }
         }
         $connector->removePropertyValues($nextActivitiesProp);
     } elseif ($property->getUri() == PROPERTY_TRANSITIONRULES_THEN || $property->getUri() == PROPERTY_TRANSITIONRULES_ELSE) {
         //it is a split connector: get the transition rule, if exists
         $transitionRule = $connector->getOnePropertyValue(new core_kernel_classes_Property(PROPERTY_CONNECTORS_TRANSITIONRULE));
         if (!is_null($transitionRule)) {
             $nextActivity = $transitionRule->getOnePropertyValue($property);
             if (!is_null($nextActivity)) {
                 if ($connectorService->isConnector($nextActivity)) {
                     $nextActivityRef = $nextActivity->getUniquePropertyValue($activityRefProp)->getUri();
                     if ($nextActivityRef == $activityRef) {
                         //delete following connectors only if they have the same activity reference
                         wfAuthoring_models_classes_ConnectorService::singleton()->delete($nextActivity);
                     }
                 }
                 $connector->removePropertyValues($nextActivitiesProp, array('pattern' => $nextActivity->getUri()));
                 $transitionRule->removePropertyValues($property, array('pattern' => $nextActivity->getUri()));
             }
         }
     }
 }
 /**
  * Delete password recovery token.
  * 
  * @param \core_kernel_classes_Resource $user
  * @return boolean
  */
 public function deleteToken(\core_kernel_classes_Resource $user)
 {
     $tokenProperty = new \core_kernel_classes_Property(self::PROPERTY_PASSWORD_RECOVERY_TOKEN);
     return $user->removePropertyValues($tokenProperty);
 }
 /**
  * 
  * @author Lionel Lecaque, lionel@taotesting.com
  * @param core_kernel_classes_Resource $resource
  * @param string $newType
  */
 public static function switchType(core_kernel_classes_Resource $resource, $newType)
 {
     $resource->removePropertyValues(new core_kernel_classes_Property(RDF_TYPE));
     $resource->setPropertyValue(new core_kernel_classes_Property(RDF_TYPE), $newType);
 }
Beispiel #5
0
 /**
  * Uninclude a Role from antother Role.
  * 
  * @access public
  * @author Jerome Bogaerts, <*****@*****.**>
  * @param core_kernel_classes_Resource role The Role from which you want to uninclude a Role.
  * @param core_kernel_classes_Resource roleToUninclude The Role to uninclude. 
  */
 public function unincludeRole(core_kernel_classes_Resource $role, core_kernel_classes_Resource $roleToUninclude)
 {
     $includesRoleProperty = new core_kernel_classes_Property(PROPERTY_ROLE_INCLUDESROLE);
     $role->removePropertyValues($includesRoleProperty, array('like' => false, 'pattern' => $roleToUninclude->getUri()));
     // invalidate cache for the role.
     if (GENERIS_CACHE_USERS_ROLES == true) {
         core_kernel_users_Cache::removeIncludedRoles($role);
         // For each roles that have $role for included role,
         // remove the cache entry.
         foreach ($this->getAllRoles() as $r) {
             $includedRoles = $this->getIncludedRoles($r);
             if (array_key_exists($role->getUri(), $includedRoles)) {
                 core_kernel_users_Cache::removeIncludedRoles($r);
             }
         }
     }
 }