Пример #1
0
//We aren't going to reset, unless the user's asked to
$reset = $request->getValidated('reset', 'string') ? true : false;
//We display by group, unless the user's asked to not
$group_first = $request->getValidated('group_first', 'string') ? true : false;
//We show the first group or the first field, unless the user's asked to show a specific
$selected_id = $request->getValidated('selected_id', 'uint', false);
//}}}
switch ($perm_type) {
    case 'tracker':
        if ($update || $reset) {
            if ($update) {
                permission_process_update_tracker_permissions($group_id, $atid, $_REQUEST);
            } else {
                if ($reset) {
                    //The user want to clear permissions
                    permission_clear_all_tracker($group_id, $atid);
                }
            }
        }
        //display
        $ath->adminHeader(array('title' => $Language->getText('tracker_admin_field_usage', 'tracker_admin') . $Language->getText('tracker_admin_field_usage', 'usage_admin'), 'help' => 'TrackerAdministration.html#TrackerAndArtifactPermissionsManagement'));
        $ugroups_permissions = permission_get_tracker_ugroups_permissions($group_id, $atid);
        $ath->displayPermissionsTracker($ugroups_permissions);
        break;
    case 'fields':
        if ($update) {
            if ($request->exist('permissions') && is_array($request->get('permissions'))) {
                $fields = $art_field_fact->getAllUsedFields();
                permission_process_update_fields_permissions($group_id, $atid, $fields, $request->get('permissions'));
            }
        }
Пример #2
0
 /**
  *	Delete a tracker
  *
  *  @aparam atid: the artifact type id
  *
  *	@return	boolean
  */
 function deleteArtifactType($atid)
 {
     // Delete artifact_canned_responses
     $sql = "DELETE FROM artifact_canned_responses \n\t\t\t    WHERE group_artifact_id=" . db_ei($atid);
     db_query($sql);
     // Delete artifact_notification
     $sql = "DELETE FROM artifact_notification  \n\t\t\t    WHERE group_artifact_id=" . db_ei($atid);
     db_query($sql);
     // Delete artifact_notification_event
     $sql = "DELETE FROM artifact_notification_event   \n\t\t\t    WHERE group_artifact_id=" . db_ei($atid);
     db_query($sql);
     // Delete artifact_notification_role
     $sql = "DELETE FROM artifact_notification_role   \n\t\t\t    WHERE group_artifact_id=" . db_ei($atid);
     db_query($sql);
     // Delete artifact_perm
     $sql = "DELETE FROM artifact_perm   \n\t\t\t    WHERE group_artifact_id=" . db_ei($atid);
     db_query($sql);
     // We need to instanciate an artifactType to instanciate the factories
     $artifactType = new ArtifactType($this->getGroup(), $atid, false);
     $art_field_fact = new ArtifactFieldFactory($artifactType);
     $art_fieldset_fact = new ArtifactFieldSetFactory($artifactType);
     // Delete the fields of this tracker
     $art_field_fact->deleteFields($atid);
     // Delete the field sets of this tracker
     $art_fieldset_fact->deleteFieldSets();
     // Delete the artifact_report
     $art_report_fact = new ArtifactReportFactory();
     $art_report_fact->deleteReports($atid);
     //Generate an event
     $em =& EventManager::instance();
     $pref_params = array('atid' => $atid);
     $em->processEvent('artifactType_deleted', $pref_params);
     // Delete the artifact rules
     $art_rule_fact = ArtifactRuleFactory::instance();
     $art_rule_fact->deleteRulesByArtifactType($atid);
     // Delete artifact_watcher (be carefull, the column is named artifact_group_id)
     $sql = "DELETE FROM artifact_watcher   \n\t\t\t    WHERE artifact_group_id=" . db_ei($atid);
     db_query($sql);
     // Delete all records linked to artifact_id
     $sql_artifacts = 'SELECT artifact_id ' . 'FROM artifact ' . 'WHERE group_artifact_id=' . db_ei($atid);
     //echo $sql_artifacts;
     $res = db_query($sql_artifacts);
     while ($artifacts_array = db_fetch_array($res)) {
         $id = $artifacts_array["artifact_id"];
         // Delete artifact_cc records
         $sql = "DELETE FROM artifact_cc WHERE artifact_id = " . db_ei($id);
         db_query($sql);
         // Delete artifact_dependencies records
         $sql = "DELETE FROM artifact_dependencies WHERE artifact_id = " . db_ei($id);
         db_query($sql);
         // Delete artifact_field_value records
         $sql = "DELETE FROM artifact_field_value WHERE artifact_id = " . db_ei($id);
         db_query($sql);
         // Delete artifact_file records
         $sql = "DELETE FROM artifact_file WHERE artifact_id = " . db_ei($id);
         db_query($sql);
         // Delete artifact_history records
         $sql = "DELETE FROM artifact_history WHERE artifact_id = " . db_ei($id);
         db_query($sql);
         // Delete artifact records
         $sql = "DELETE FROM artifact WHERE artifact_id = " . db_ei($id);
         db_query($sql);
     }
     // while
     // Delete artifact_group_list
     $sql = "DELETE FROM artifact_group_list\n\t\t\t    WHERE group_artifact_id=" . db_ei($atid);
     //echo $sql;
     $result = db_query($sql);
     if (!$result || db_affected_rows($result) <= 0) {
         $this->setError('Error: deleteArtifactType ' . db_error());
         return false;
     }
     //Remove permissions
     permission_clear_all_tracker($this->Group->getID(), $atid);
     $em = EventManager::instance();
     $em->processEvent("artifact_type_factory_delete_artifact_type", array('tracker_id' => $atid));
     return true;
 }