Esempio n. 1
0
 protected function _preDelete()
 {
     TBGRolePermissionsTable::getTable()->clearPermissionsForRole($this->getID());
     TBGProjectAssignedTeamsTable::getTable()->deleteByRoleID($this->getID());
     TBGProjectAssignedUsersTable::getTable()->deleteByRoleID($this->getID());
     TBGEditionAssignedTeamsTable::getTable()->deleteByRoleID($this->getID());
     TBGEditionAssignedUsersTable::getTable()->deleteByRoleID($this->getID());
     TBGComponentAssignedTeamsTable::getTable()->deleteByRoleID($this->getID());
     TBGComponentAssignedUsersTable::getTable()->deleteByRoleID($this->getID());
 }
Esempio n. 2
0
 /**
  * Add an assignee to the component
  *
  * @param TBGIdentifiableClass $assignee
  * @param integer $role
  *
  * @return boolean
  */
 public function removeAssignee(TBGIdentifiableClass $assignee)
 {
     if ($assignee instanceof TBGUser) {
         $retval = TBGComponentAssignedUsersTable::getTable()->removeUserFromComponent($this->getID(), $assignee, $role);
     } elseif ($assignee instanceof TBGTeam) {
         $retval = TBGComponentAssignedTeamsTable::getTable()->removeTeamFromComponent($this->getID(), $assignee, $role);
     }
     return $retval;
 }
Esempio n. 3
0
 protected function _upgradeFrom3dot1()
 {
     // Add classpath for existing old tables used for upgrade
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'installation' . DS . 'classes' . DS . 'upgrade_3.1');
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'mailing' . DS . 'classes' . DS . 'B2DB');
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'mailing' . DS . 'classes');
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'classes' . DS . 'B2DB');
     TBGContext::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . 'publish' . DS . 'classes');
     // Create new tables
     TBGDashboardViewsTable::getTable()->create();
     TBGOpenIdAccountsTable::getTable()->create();
     TBGProjectAssignedUsersTable::getTable()->create();
     TBGProjectAssignedTeamsTable::getTable()->create();
     TBGEditionAssignedUsersTable::getTable()->create();
     TBGEditionAssignedTeamsTable::getTable()->create();
     TBGComponentAssignedUsersTable::getTable()->create();
     TBGComponentAssignedTeamsTable::getTable()->create();
     TBGRolePermissionsTable::getTable()->create();
     TBGUserScopesTable::getTable()->create();
     // Upgrade existing tables
     TBGProjectsTable::getTable()->upgrade(TBGProjectsTable3dot1::getTable());
     TBGUsersTable::getTable()->upgrade(TBGUsersTable3dot1::getTable());
     TBGIssuesTable::getTable()->upgrade(TBGIssuesTable3dot1::getTable());
     TBGIssueTypesTable::getTable()->upgrade(TBGIssueTypesTable3dot1::getTable());
     TBGListTypesTable::getTable()->upgrade(TBGListTypesTable3dot1::getTable());
     TBGEditionsTable::getTable()->upgrade(TBGEditionsTable3dot1::getTable());
     TBGBuildsTable::getTable()->upgrade(TBGBuildsTable3dot1::getTable());
     TBGCommentsTable::getTable()->upgrade(TBGCommentsTable3dot1::getTable());
     TBGComponentsTable::getTable()->upgrade(TBGComponentsTable3dot1::getTable());
     TBGCustomFieldsTable::getTable()->upgrade(TBGCustomFieldsTable3dot1::getTable());
     TBGCustomFieldOptionsTable::getTable()->upgrade(TBGCustomFieldOptionsTable3dot1::getTable());
     TBGIssueCustomFieldsTable::getTable()->upgrade(TBGIssueCustomFieldsTable3dot1::getTable());
     // Create new module tables
     TBGIncomingEmailAccountTable::getTable()->create();
     // Add new indexes
     TBGArticlesTable::getTable()->createIndexes();
     TBGCommentsTable::getTable()->createIndexes();
     TBGIssueAffectsBuildTable::getTable()->createIndexes();
     TBGIssueAffectsComponentTable::getTable()->createIndexes();
     TBGIssueAffectsEditionTable::getTable()->createIndexes();
     TBGIssueFieldsTable::getTable()->createIndexes();
     TBGIssueFilesTable::getTable()->createIndexes();
     TBGIssuesTable::getTable()->createIndexes();
     TBGIssuetypeSchemesTable::getTable()->createIndexes();
     TBGPermissionsTable::getTable()->createIndexes();
     TBGProjectsTable::getTable()->createIndexes();
     TBGSettingsTable::getTable()->createIndexes();
     TBGTeamMembersTable::getTable()->createIndexes();
     TBGUserIssuesTable::getTable()->createIndexes();
     TBGUsersTable::getTable()->createIndexes();
     TBGUserScopesTable::getTable()->createIndexes();
     if (TBGContext::getRequest()->getParameter('fix_my_timestamps', false)) {
         $this->_fixTimestamps();
     }
     foreach (TBGScope::getAll() as $scope) {
         TBGRole::loadFixtures($scope);
         foreach (TBGDatatype::getTypes() as $type => $class) {
             TBGContext::setPermission('set_datatype_' . $type, 0, 'core', 0, 0, 0, true, $scope->getID());
         }
         TBGContext::setPermission('page_confirm_scope_access', 0, 'core', 0, 0, 0, true, $scope->getID());
         if (!TBGSettings::get(TBGSettings::SETTING_DEFAULT_WORKFLOW, 'core', $scope->getID())) {
             $workflow_id = TBGWorkflowsTable::getTable()->getFirstIdByScope($scope->getID());
             if ($workflow_id) {
                 TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_WORKFLOW, $workflow_id, 'core', $scope->getID());
             } else {
                 TBGWorkflow::loadFixtures($scope);
             }
         }
         if (!TBGSettings::get(TBGSettings::SETTING_DEFAULT_WORKFLOWSCHEME, 'core', $scope->getID())) {
             $workflow_scheme_id = TBGWorkflowSchemesTable::getTable()->getFirstIdByScope($scope->getID());
             if ($workflow_scheme_id) {
                 TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_WORKFLOWSCHEME, $workflow_scheme_id, 'core', $scope->getID());
             } else {
                 TBGWorkflowScheme::loadFixtures($scope);
             }
         }
         if (!TBGSettings::get(TBGSettings::SETTING_DEFAULT_ISSUETYPESCHEME, 'core', $scope->getID())) {
             $issuetype_scheme_id = TBGIssuetypeSchemesTable::getTable()->getFirstIdByScope($scope->getID());
             if ($issuetype_scheme_id) {
                 TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_ISSUETYPESCHEME, $issuetype_scheme_id, 'core', $scope->getID());
             } else {
                 TBGIssuetypeScheme::loadFixtures($scope);
             }
         }
         TBGSettings::saveSetting(TBGSettings::SETTING_FAVICON_ID, 0, 'core', $scope->getID());
         TBGSettings::saveSetting(TBGSettings::SETTING_FAVICON_TYPE, 0, 'core', $scope->getID());
         TBGSettings::saveSetting(TBGSettings::SETTING_HEADER_ICON_ID, 0, 'core', $scope->getID());
         TBGSettings::saveSetting(TBGSettings::SETTING_HEADER_ICON_TYPE, 0, 'core', $scope->getID());
     }
     $linkstable = TBGLinksTable::getTable();
     $crit = $linkstable->getCriteria();
     $crit->addUpdate(TBGLinksTable::URL, 'http://issues.thebuggenie.com');
     $crit->addWhere(TBGLinksTable::URL, 'http://thebuggenie.com/thebuggenie');
     $crit->addOr(TBGLinksTable::URL, 'http://www.thebuggenie.com/thebuggenie');
     $linkstable->doUpdate($crit);
     $listtypestable = TBGListTypesTable::getTable();
     $crit = $listtypestable->getCriteria();
     $crit->addUpdate(TBGListTypesTable::ITEMTYPE, 'role');
     $crit->addWhere(TBGListTypesTable::ITEMTYPE, 'projectrole');
     $listtypestable->doUpdate($crit);
     $crit = $listtypestable->getCriteria();
     $crit->addUpdate(TBGListTypesTable::ITEMTYPE, 'priority');
     $crit->addWhere(TBGListTypesTable::ITEMTYPE, 'b2_prioritytypes');
     $listtypestable->doUpdate($crit);
     TBGWorkflowTransitionsTable::getTable()->upgradeFrom3dot1();
     TBGSettings::saveSetting(TBGSettings::SETTING_ICONSET, TBGSettings::get(TBGSettings::SETTING_THEME_NAME));
     TBGContext::setPermission('readarticle', 0, 'publish', 0, 0, 0, true);
     foreach (TBGProject::getAll() as $project) {
         TBGDashboardViewsTable::getTable()->setDefaultViews($project->getID(), TBGDashboardViewsTable::TYPE_PROJECT);
         if (!$project->getKey()) {
             $project->setName($project->getName());
         }
     }
     $this->upgrade_complete = true;
 }