コード例 #1
0
ファイル: TBGGroup.class.php プロジェクト: oparoz/thebuggenie
 public static function loadFixtures(TBGScope $scope)
 {
     $scope_id = $scope->getID();
     $admin_group = new TBGGroup();
     $admin_group->setName('Administrators');
     $admin_group->setScope($scope);
     $admin_group->save();
     TBGSettings::saveSetting('admingroup', $admin_group->getID(), 'core', $scope_id);
     $user_group = new TBGGroup();
     $user_group->setName('Regular users');
     $user_group->setScope($scope);
     $user_group->save();
     TBGSettings::saveSetting('defaultgroup', $user_group->getID(), 'core', $scope_id);
     $guest_group = new TBGGroup();
     $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) = TBGUser::loadFixtures($scope, $admin_group, $user_group, $guest_group);
         TBGUserScopesTable::getTable()->addUserToScope($guestuser_id, $scope->getID(), $guest_group->getID(), true);
         TBGUserScopesTable::getTable()->addUserToScope($adminuser_id, $scope->getID(), $admin_group->getID(), true);
     } else {
         $default_scope_id = TBGSettings::getDefaultScopeID();
         $default_user_id = (int) TBGSettings::get(TBGSettings::SETTING_DEFAULT_USER_ID, 'core', $default_scope_id);
         TBGUserScopesTable::getTable()->addUserToScope($default_user_id, $scope->getID(), $user_group->getID(), true);
         TBGUserScopesTable::getTable()->addUserToScope(1, $scope->getID(), $admin_group->getID());
         TBGSettings::saveSetting(TBGSettings::SETTING_DEFAULT_USER_ID, $default_user_id, 'core', $scope->getID());
     }
     TBGPermissionsTable::getTable()->loadFixtures($scope, $admin_group->getID(), $guest_group->getID());
 }
コード例 #2
0
 public static function loadFixtures(TBGScope $scope)
 {
     $scope_id = $scope->getID();
     $admin_group = new TBGGroup();
     $admin_group->setName('Administrators');
     $admin_group->setScope($scope);
     $admin_group->save();
     TBGSettings::saveSetting('admingroup', $admin_group->getID(), 'core', $scope_id);
     $user_group = new TBGGroup();
     $user_group->setName('Regular users');
     $user_group->setScope($scope);
     $user_group->save();
     TBGSettings::saveSetting('defaultgroup', $user_group->getID(), 'core', $scope_id);
     $guest_group = new TBGGroup();
     $guest_group->setName('Guests');
     $guest_group->setScope($scope);
     $guest_group->save();
     // Set up initial users, and their permissions
     TBGUser::loadFixtures($scope, $admin_group, $user_group, $guest_group);
     TBGPermissionsTable::getTable()->loadFixtures($scope, $admin_group->getID(), $guest_group->getID());
 }
コード例 #3
0
 public function runAddGroup(TBGRequest $request)
 {
     try {
         $mode = $request->getParameter('mode');
         if ($group_name = $request->getParameter('group_name')) {
             if ($mode == 'clone') {
                 try {
                     $old_group = TBGContext::factory()->TBGGroup($request->getParameter('group_id'));
                 } catch (Exception $e) {
                 }
                 if (!$old_group instanceof TBGGroup) {
                     throw new Exception(TBGContext::getI18n()->__("You cannot clone this group"));
                 }
             }
             if (TBGGroup::doesGroupNameExist(trim($group_name))) {
                 throw new Exception(TBGContext::getI18n()->__("Please enter a group name that doesn't already exist"));
             }
             $group = new TBGGroup();
             $group->setName($group_name);
             $group->save();
             if ($mode == 'clone') {
                 if ($request->getParameter('clone_permissions')) {
                     TBGPermissionsTable::getTable()->cloneGroupPermissions($old_group->getID(), $group->getID());
                 }
                 $message = TBGContext::getI18n()->__('The group was cloned');
             } else {
                 $message = TBGContext::getI18n()->__('The group was added');
             }
             return $this->renderJSON(array('failed' => false, 'message' => $message, 'content' => $this->getTemplateHTML('configuration/groupbox', array('group' => $group))));
         } else {
             throw new Exception(TBGContext::getI18n()->__('Please enter a group name'));
         }
     } catch (Exception $e) {
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('failed' => true, 'error' => $e->getMessage()));
     }
 }
コード例 #4
0
    ?>
</td>
						<td><label for="user_<?php 
    echo $user->getID();
    ?>
_group"><?php 
    echo __('In group');
    ?>
</label></td>
						<td>
							<select name="group" id="user_<?php 
    echo $user->getID();
    ?>
_group">
								<?php 
    foreach (TBGGroup::getAll() as $group) {
        ?>
									<option value="<?php 
        echo $group->getID();
        ?>
"<?php 
        if ($user->getGroupID() == $group->getID()) {
            ?>
 selected<?php 
        }
        ?>
><?php 
        echo $group->getName();
        ?>
</option>
								<?php 
コード例 #5
0
 public function loadFixtures()
 {
     // Load initial settings
     TBGSettingsTable::getTable()->loadFixtures($this);
     TBGSettings::loadSettings();
     // Load group, users and permissions fixtures
     TBGGroup::loadFixtures($this);
     // Load initial teams
     TBGTeam::loadFixtures($this);
     // Set up user states, like "available", "away", etc
     TBGUserstate::loadFixtures($this);
     // Set up data types
     list($b_id, $f_id, $e_id, $t_id, $u_id, $i_id) = TBGIssuetype::loadFixtures($this);
     $scheme = TBGIssuetypeScheme::loadFixtures($this);
     TBGIssueFieldsTable::getTable()->loadFixtures($this, $scheme, $b_id, $f_id, $e_id, $t_id, $u_id, $i_id);
     TBGDatatype::loadFixtures($this);
     // Set up workflows
     TBGWorkflow::loadFixtures($this);
     TBGWorkflowSchemesTable::getTable()->loadFixtures($this);
     TBGWorkflowIssuetypeTable::getTable()->loadFixtures($this);
     // Set up left menu links
     TBGLinksTable::getTable()->loadFixtures($this);
 }
コード例 #6
0
		</tr>
	</thead>
	<tbody>
		<tr class="hover_highlight">
			<td style="padding: 2px; border-bottom: 1px solid #EAEAEA;"><?php 
echo __('<b>Global </b>(Everyone with access)');
?>
</td>
			<td style="padding: 2px; border-bottom: 1px solid #EAEAEA; text-align: center;">
				<?php 
include_component('configuration/permissionsinfoitem', array('key' => $key, 'target_id' => $target_id, 'type' => 'everyone', 'mode' => $mode, 'item_id' => 0, 'module' => $module, 'access_level' => $access_level));
?>
			</td>
		</tr>
		<?php 
$groups = TBGGroup::getAll();
?>
		<?php 
$gcount = count($groups);
$cc = 1;
?>
		<?php 
foreach ($groups as $group) {
    ?>
			<tr class="hover_highlight">
				<td style="padding: 2px;<?php 
    if ($cc == $gcount) {
        ?>
 border-bottom: 1px solid #EAEAEA;<?php 
    }
    ?>