Exemplo n.º 1
0
 public function loadFixtures(\thebuggenie\core\entities\Scope $scope)
 {
     foreach (IssueTypes::getTable()->getAllIDsByScopeID($scope->getID()) as $issuetype_id) {
         $crit = $this->getCriteria();
         $crit->addInsert(self::SCOPE, $scope->getID());
         $crit->addInsert(self::WORKFLOW_ID, \thebuggenie\core\framework\Settings::getCoreWorkflow()->getID());
         $crit->addInsert(self::WORKFLOW_SCHEME_ID, \thebuggenie\core\framework\Settings::getCoreWorkflowScheme()->getID());
         $crit->addInsert(self::ISSUETYPE_ID, $issuetype_id);
         $this->doInsert($crit);
     }
 }
Exemplo n.º 2
0
 public function do_execute()
 {
     $hostname = $this->getProvidedArgument('hostname');
     $this->cliEcho('Checking scope availability ...');
     if (tables\ScopeHostnames::getTable()->getScopeIDForHostname($hostname) === null) {
         $this->cliEcho("available!\n");
         $this->cliEcho("Creating scope ...");
         $scope = new entities\Scope();
         $scope->addHostname($hostname);
         $scope->setName($this->getProvidedArgument('shortname'));
         $uploads_enabled = $this->getProvidedArgument('enable_uploads', 'yes') == 'yes';
         $scope->setUploadsEnabled((bool) $uploads_enabled);
         $scope->setMaxUploadLimit($this->getProvidedArgument('upload_limit', 0));
         $scope->setMaxProjects($this->getProvidedArgument('projects', 0));
         $scope->setMaxUsers($this->getProvidedArgument('users', 0));
         $scope->setMaxTeams($this->getProvidedArgument('teams', 0));
         $scope->setMaxWorkflowsLimit($this->getProvidedArgument('workflows', 0));
         $scope->setEnabled();
         $this->cliEcho(".");
         $scope->save();
         $this->cliEcho(".done!\n");
         $admin_user = $this->getProvidedArgument('scope_admin');
         if ($admin_user) {
             $user = entities\User::getByUsername($admin_user);
             if ($user instanceof entities\User) {
                 $this->cliEcho("Adding user {$admin_user} to scope\n");
                 $admin_group_id = (int) framework\Settings::get(framework\Settings::SETTING_ADMIN_GROUP, 'core', $scope->getID());
                 tables\UserScopes::getTable()->addUserToScope($user->getID(), $scope->getID(), $admin_group_id, true);
             } else {
                 $this->cliEcho("Could not add user {$admin_user} to scope (username not found)\n");
             }
         }
         if ($this->getProvidedArgument('remove_admin', 'no') == 'yes') {
             $this->cliEcho("Removing administrator user from scope\n");
             tables\UserScopes::getTable()->removeUserFromScope(1, $scope->getID());
         }
         foreach (framework\Context::getModules() as $module) {
             $module_name = $module->getName();
             if ($module_name == 'publish') {
                 continue;
             }
             if ($this->getProvidedArgument("install_module_{$module_name}", "no") == 'yes') {
                 $this->cliEcho("Installing module {$module_name}\n");
                 entities\Module::installModule($module_name, $scope);
             }
         }
     } else {
         $this->cliEcho("not available\n", 'red');
     }
     $this->cliEcho("\n");
 }
Exemplo n.º 3
0
 public static function loadFixtures(\thebuggenie\core\entities\Scope $scope)
 {
     $scope_id = $scope->getID();
     $admin_group = new \thebuggenie\core\entities\Group();
     $admin_group->setName('Administrators');
     $admin_group->setScope($scope);
     $admin_group->save();
     \thebuggenie\core\framework\Settings::saveSetting('admingroup', $admin_group->getID(), 'core', $scope_id);
     $user_group = new \thebuggenie\core\entities\Group();
     $user_group->setName('Regular users');
     $user_group->setScope($scope);
     $user_group->save();
     \thebuggenie\core\framework\Settings::saveSetting('defaultgroup', $user_group->getID(), 'core', $scope_id);
     $guest_group = new \thebuggenie\core\entities\Group();
     $guest_group->setName('Guests');
     $guest_group->setScope($scope);
     $guest_group->save();
     // Set up initial users, and their permissions
     if ($scope->isDefault()) {
         list($guestuser_id, $adminuser_id) = \thebuggenie\core\entities\User::loadFixtures($scope, $admin_group, $user_group, $guest_group);
         tables\UserScopes::getTable()->addUserToScope($guestuser_id, $scope->getID(), $guest_group->getID(), true);
         tables\UserScopes::getTable()->addUserToScope($adminuser_id, $scope->getID(), $admin_group->getID(), true);
     } else {
         $default_scope_id = \thebuggenie\core\framework\Settings::getDefaultScopeID();
         $default_user_id = (int) \thebuggenie\core\framework\Settings::get(\thebuggenie\core\framework\Settings::SETTING_DEFAULT_USER_ID, 'core', $default_scope_id);
         tables\UserScopes::getTable()->addUserToScope($default_user_id, $scope->getID(), $user_group->getID(), true);
         tables\UserScopes::getTable()->addUserToScope(1, $scope->getID(), $admin_group->getID());
         \thebuggenie\core\framework\Settings::saveSetting(\thebuggenie\core\framework\Settings::SETTING_DEFAULT_USER_ID, $default_user_id, 'core', $scope->getID());
     }
     tables\Permissions::getTable()->loadFixtures($scope, $admin_group->getID(), $guest_group->getID());
 }
Exemplo n.º 4
0
 public static function loadFixtures(\thebuggenie\core\entities\Scope $scope)
 {
     $scheme = new IssuetypeScheme();
     $scheme->setScope($scope->getID());
     $scheme->setName("Default issuetype scheme");
     $scheme->setDescription("This is the default issuetype scheme. It is used by all projects with no specific issuetype scheme selected. This scheme cannot be edited or removed.");
     $scheme->save();
     framework\Settings::saveSetting(framework\Settings::SETTING_DEFAULT_ISSUETYPESCHEME, $scheme->getID(), 'core', $scope->getID());
     foreach (Issuetype::getAll() as $issuetype) {
         $scheme->setIssuetypeEnabled($issuetype);
         if ($issuetype->getIcon() == 'developer_report') {
             $scheme->setIssuetypeRedirectedAfterReporting($issuetype, false);
         }
         if (in_array($issuetype->getIcon(), array('task', 'developer_report', 'idea'))) {
             $scheme->setIssuetypeReportable($issuetype, false);
         }
     }
     return $scheme;
 }
Exemplo n.º 5
0
 public static function loadFixtures(\thebuggenie\core\entities\Scope $scope)
 {
     $scope_id = $scope->getID();
     $bug_report = new \thebuggenie\core\entities\Issuetype();
     $bug_report->setName('Bug report');
     $bug_report->setIcon('bug_report');
     $bug_report->setScope($scope_id);
     $bug_report->setDescription('Have you discovered a bug in the application, or is something not working as expected?');
     $bug_report->save();
     \thebuggenie\core\framework\Settings::saveSetting('defaultissuetypefornewissues', $bug_report->getID(), 'core', $scope_id);
     \thebuggenie\core\framework\Settings::saveSetting('issuetype_bug_report', $bug_report->getID(), 'core', $scope_id);
     $feature_request = new \thebuggenie\core\entities\Issuetype();
     $feature_request->setName('Feature request');
     $feature_request->setIcon('feature_request');
     $feature_request->setDescription('Are you missing some specific feature, or is your favourite part of the application a bit lacking?');
     $feature_request->setScope($scope_id);
     $feature_request->save();
     \thebuggenie\core\framework\Settings::saveSetting('issuetype_feature_request', $feature_request->getID(), 'core', $scope_id);
     $enhancement = new \thebuggenie\core\entities\Issuetype();
     $enhancement->setName('Enhancement');
     $enhancement->setIcon('enhancement');
     $enhancement->setDescription('Have you found something that is working in a way that could be improved?');
     $enhancement->setScope($scope_id);
     $enhancement->save();
     \thebuggenie\core\framework\Settings::saveSetting('issuetype_enhancement', $enhancement->getID(), 'core', $scope_id);
     $task = new \thebuggenie\core\entities\Issuetype();
     $task->setName('Task');
     $task->setIcon('task');
     $task->setIsTask();
     $task->setScope($scope_id);
     $task->save();
     \thebuggenie\core\framework\Settings::saveSetting('issuetype_task', $task->getID(), 'core', $scope_id);
     $user_story = new \thebuggenie\core\entities\Issuetype();
     $user_story->setName('User story');
     $user_story->setIcon('developer_report');
     $user_story->setDescription('Doing it Agile-style. Issue type perfectly suited for entering user stories');
     $user_story->setScope($scope_id);
     $user_story->save();
     \thebuggenie\core\framework\Settings::saveSetting('issuetype_user_story', $user_story->getID(), 'core', $scope_id);
     $epic = new \thebuggenie\core\entities\Issuetype();
     $epic->setName('Epic');
     $epic->setIcon('epic');
     $epic->setDescription('Issue type suited for entering epics');
     $epic->setScope($scope_id);
     $epic->save();
     \thebuggenie\core\framework\Settings::saveSetting('issuetype_epic', $epic->getID(), 'core', $scope_id);
     $idea = new \thebuggenie\core\entities\Issuetype();
     $idea->setName('Idea');
     $idea->setIcon('idea');
     $idea->setDescription('Express yourself - share your ideas with the rest of the team!');
     $idea->setScope($scope_id);
     $idea->save();
     \thebuggenie\core\framework\Settings::saveSetting('issuetype_idea', $idea->getID(), 'core', $scope_id);
     return array($bug_report->getID(), $feature_request->getID(), $enhancement->getID(), $task->getID(), $user_story->getID(), $idea->getID(), $epic->getID());
 }
Exemplo n.º 6
0
 public function loadFixtures(\thebuggenie\core\entities\Scope $scope)
 {
     $steps = array();
     $steps[] = array('name' => 'New', 'description' => 'A new issue, not yet handled', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('new')->getID(), 'editable' => true, 'is_closed' => false);
     $steps[] = array('name' => 'Investigating', 'description' => 'An issue that is being investigated, looked into or is by other means between new and unconfirmed state', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('investigating')->getID(), 'editable' => true, 'is_closed' => false);
     $steps[] = array('name' => 'Confirmed', 'description' => 'An issue that has been confirmed', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('confirmed')->getID(), 'editable' => false, 'is_closed' => false);
     $steps[] = array('name' => 'In progress', 'description' => 'An issue that is being adressed', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('beingworkedon')->getID(), 'editable' => false, 'is_closed' => false);
     $steps[] = array('name' => 'Ready for testing', 'description' => 'An issue that has been marked fixed and is ready for testing', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('readyfortesting/qa')->getID(), 'editable' => false, 'is_closed' => false);
     $steps[] = array('name' => 'Testing', 'description' => 'An issue where the proposed or implemented solution is currently being tested or approved', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('testing/qa')->getID(), 'editable' => false, 'is_closed' => false);
     $steps[] = array('name' => 'Rejected', 'description' => 'A closed issue that has been rejected', 'status_id' => \thebuggenie\core\entities\Status::getByKeyish('notabug')->getID(), 'editable' => false, 'is_closed' => true);
     $steps[] = array('name' => 'Closed', 'description' => 'A closed issue', 'status_id' => null, 'editable' => false, 'is_closed' => true);
     foreach ($steps as $step) {
         $crit = $this->getCriteria();
         $crit->addInsert(self::WORKFLOW_ID, 1);
         $crit->addInsert(self::SCOPE, $scope->getID());
         $crit->addInsert(self::NAME, $step['name']);
         $crit->addInsert(self::DESCRIPTION, $step['description']);
         $crit->addInsert(self::STATUS_ID, $step['status_id']);
         $crit->addInsert(self::CLOSED, $step['is_closed']);
         $crit->addInsert(self::EDITABLE, $step['editable']);
         $this->doInsert($crit);
     }
 }
Exemplo n.º 7
0
 public function loadFixtures(\thebuggenie\core\entities\Scope $scope)
 {
     $i18n = framework\Context::getI18n();
     $settings = array();
     $settings[\thebuggenie\core\framework\Settings::SETTING_THEME_NAME] = 'oxygen';
     $settings[\thebuggenie\core\framework\Settings::SETTING_REQUIRE_LOGIN] = 0;
     $settings[\thebuggenie\core\framework\Settings::SETTING_DEFAULT_USER_IS_GUEST] = 1;
     $settings[\thebuggenie\core\framework\Settings::SETTING_ALLOW_REGISTRATION] = 1;
     $settings[\thebuggenie\core\framework\Settings::SETTING_RETURN_FROM_LOGIN] = 'referer';
     $settings[\thebuggenie\core\framework\Settings::SETTING_RETURN_FROM_LOGOUT] = 'home';
     $settings[\thebuggenie\core\framework\Settings::SETTING_SHOW_PROJECTS_OVERVIEW] = 1;
     $settings[\thebuggenie\core\framework\Settings::SETTING_ALLOW_USER_THEMES] = 0;
     $settings[\thebuggenie\core\framework\Settings::SETTING_ENABLE_UPLOADS] = 0;
     $settings[\thebuggenie\core\framework\Settings::SETTING_ENABLE_GRAVATARS] = 1;
     $settings[\thebuggenie\core\framework\Settings::SETTING_UPLOAD_RESTRICTION_MODE] = 'blacklist';
     $settings[\thebuggenie\core\framework\Settings::SETTING_UPLOAD_EXTENSIONS_LIST] = 'exe,bat,php,asp,jsp';
     $settings[\thebuggenie\core\framework\Settings::SETTING_UPLOAD_STORAGE] = 'files';
     $settings[\thebuggenie\core\framework\Settings::SETTING_UPLOAD_LOCAL_PATH] = THEBUGGENIE_PATH . 'files/';
     $settings[\thebuggenie\core\framework\Settings::SETTING_UPLOAD_ALLOW_IMAGE_CACHING] = 0;
     $settings[\thebuggenie\core\framework\Settings::SETTING_UPLOAD_DELIVERY_USE_XSEND] = 0;
     $settings[\thebuggenie\core\framework\Settings::SETTING_TBG_NAME] = 'The Bug Genie';
     $settings[\thebuggenie\core\framework\Settings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_LANGUAGE] = 'html4strict';
     $settings[\thebuggenie\core\framework\Settings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_NUMBERING] = '3';
     $settings[\thebuggenie\core\framework\Settings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_INTERVAL] = '10';
     $settings[\thebuggenie\core\framework\Settings::SETTING_ICONSET] = 'oxygen';
     $settings[\thebuggenie\core\framework\Settings::SETTING_SERVER_TIMEZONE] = date_default_timezone_get();
     if ($scope->isDefault()) {
         $settings[\thebuggenie\core\framework\Settings::SETTING_SALT] = sha1(time() . mt_rand(1000, 10000));
     }
     $scope_id = $scope->getID();
     foreach ($settings as $settings_name => $settings_val) {
         $this->saveSetting($settings_name, 'core', $settings_val, 0, $scope_id);
     }
 }
Exemplo n.º 8
0
 public function isMemberOfScope(Scope $scope)
 {
     return array_key_exists($scope->getID(), $this->getScopes());
 }
Exemplo n.º 9
0
 public function loadFixtures(\thebuggenie\core\entities\Scope $scope)
 {
     $scope_id = $scope->getID();
     $this->addMainMenuLink('http://www.thebuggenie.com', 'The Bug Genie homepage', 1, $scope_id);
     $this->addMainMenuLink('http://forum.thebuggenie.com', 'The Bug Genie forums', 2, $scope_id);
     $this->addMainMenuLink(null, null, 3, $scope_id);
     $this->addMainMenuLink('http://issues.thebuggenie.com', 'Online issue tracker', 4, $scope_id);
     $this->addMainMenuLink('', "''This is the issue tracker for The Bug Genie''", 5, $scope_id);
     $this->addMainMenuLink(null, null, 6, $scope_id);
     $this->addMainMenuLink('http://thebuggenie.wordpress.com/', 'The Bug Genie team blog', 7, $scope_id);
     $this->addMainMenuLink('', "''Stay up to date on the latest development''", 8, $scope_id);
 }
Exemplo n.º 10
0
 public function loadFixtures(\thebuggenie\core\entities\Scope $scope, $admin_group_id, $guest_group_id)
 {
     $scope_id = $scope->getID();
     $this->setPermission(0, $admin_group_id, 0, true, 'core', 'cansaveconfig', 0, $scope_id);
     $this->setPermission(0, 0, 0, true, 'core', 'page_account_access', 0, $scope_id);
     $this->setPermission(0, $guest_group_id, 0, false, 'core', 'page_account_access', 0, $scope_id);
     $this->setPermission(0, 0, 0, false, 'core', 'candoscrumplanning', 0, $scope_id);
     $this->setPermission(0, 0, 0, true, 'core', 'cancreateandeditissues', 0, $scope_id);
     $this->setPermission(0, 0, 0, true, 'core', 'canfindissuesandsavesearches', 0, $scope_id);
     $this->setPermission(0, 0, 0, false, 'core', 'cancreatepublicsearches', 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', 'cancreatepublicsearches', 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', 'caneditmainmenu', 0, $scope_id);
     $this->setPermission(0, 0, 0, true, 'core', 'caneditissuecustomfieldsown', 0, $scope_id);
     $this->setPermission(0, 0, 0, true, 'core', 'canpostandeditcomments', 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', 'canpostseeandeditallcomments', 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', "canseeproject", 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', 'candoscrumplanning', 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', "page_project_allpages_access", 0, $scope_id);
     $this->setPermission(0, 0, 0, true, 'core', "page_home_access", 0, $scope_id);
     $this->setPermission(0, 0, 0, true, 'core', "page_about_access", 0, $scope_id);
     $this->setPermission(0, 0, 0, true, 'core', "page_dashboard_access", 0, $scope_id);
     $this->setPermission(0, 0, 0, true, 'core', "page_search_access", 0, $scope_id);
     $this->setPermission(0, 0, 0, true, 'core', 'page_confirm_scope_access', 0, $scope_id);
     $this->setPermission(0, $guest_group_id, 0, false, 'core', "page_dashboard_access", 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', "page_teamlist_access", 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', "page_clientlist_access", 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', "canvoteforissues", 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', "canlockandeditlockedissues", 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', "cancreateandeditissues", 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', "caneditissue", 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', "candeleteissues", 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', "caneditissuecustomfields", 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', "canaddextrainformationtoissues", 0, $scope_id);
     $this->setPermission(0, $admin_group_id, 0, true, 'core', "canpostseeandeditallcomments", 0, $scope_id);
 }
Exemplo n.º 11
0
 public static function loadFixtures(\thebuggenie\core\entities\Scope $scope)
 {
     $workflow = new \thebuggenie\core\entities\Workflow();
     $workflow->setName("Default workflow");
     $workflow->setDescription("This is the default workflow. It is used by all projects with no specific workflow selected, and for issue types with no specific workflow specified. This workflow cannot be edited or removed.");
     $workflow->setScope($scope->getID());
     $workflow->save();
     \thebuggenie\core\framework\Settings::saveSetting(\thebuggenie\core\framework\Settings::SETTING_DEFAULT_WORKFLOW, $workflow->getID(), 'core', $scope->getID());
     WorkflowStep::loadFixtures($scope, $workflow);
 }
Exemplo n.º 12
0
 public static function loadFixtures(Scope $scope)
 {
     $available = new Userstate();
     $available->setIsOnline();
     $available->setName('Available');
     $available->save();
     $offline = new Userstate();
     $offline->setIsUnavailable();
     $offline->setName('Offline');
     $offline->save();
     $busy = new Userstate();
     $busy->setIsUnavailable();
     $busy->setIsOnline();
     $busy->setName('Busy');
     $busy->save();
     $unavailable = new Userstate();
     $unavailable->setIsUnavailable();
     $unavailable->setIsOnline();
     $unavailable->setName('Unavailable');
     $unavailable->save();
     $in_a_meeting = new Userstate();
     $in_a_meeting->setIsUnavailable();
     $in_a_meeting->setIsInMeeting();
     $in_a_meeting->setName('In a meeting');
     $in_a_meeting->save();
     $coding = new Userstate();
     $coding->setIsUnavailable();
     $coding->setIsBusy();
     $coding->setIsOnline();
     $coding->setName('Coding');
     $coding->save();
     $coffee = new Userstate();
     $coffee->setIsUnavailable();
     $coffee->setIsBusy();
     $coffee->setIsOnline();
     $coffee->setName('On coffee break');
     $away = new Userstate();
     $away->setIsUnavailable();
     $away->setIsOnline();
     $away->setIsBusy();
     $away->setIsAbsent();
     $away->setName('Away');
     $away->save();
     $vacation = new Userstate();
     $vacation->setIsUnavailable();
     $vacation->setIsBusy();
     $vacation->setIsAbsent();
     $vacation->setName('On vacation');
     $vacation->save();
     \thebuggenie\core\framework\Settings::saveSetting(\thebuggenie\core\framework\Settings::SETTING_ONLINESTATE, $available->getID(), 'core', $scope->getID());
     \thebuggenie\core\framework\Settings::saveSetting(\thebuggenie\core\framework\Settings::SETTING_OFFLINESTATE, $offline->getID(), 'core', $scope->getID());
     \thebuggenie\core\framework\Settings::saveSetting(\thebuggenie\core\framework\Settings::SETTING_AWAYSTATE, $away->getID(), 'core', $scope->getID());
 }