Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2489

Přidáno uživatelem David Raška před více než 9 roky(ů)

Upravy:
refs #1003: Pridany odkazy na detail ARO skupiny v profilu clena.
Pridana moznost rychleho nastaveni pristupovych skupin uzivatele.

Zobrazit rozdíly:

freenetis/branches/1.2/application/controllers/aro_groups.php
$view->content->form = $form;
$view->render(TRUE);
}
/**
* Edits ARO groups of user
*
* @author David Raska
* @param integer $user_id
*/
public function edit_user ($user_id = NULL)
{
// bad parameter
if (!$user_id || !is_numeric($user_id))
Controller::warning(PARAMETER);
// record doesn't exist
if (!$user_id)
Controller::error(RECORD);
$user = new User_Model($user_id);
// access check
if (!$this->acl_check_edit('Aro_groups_Controller', 'aro_group', $user->member_id))
Controller::Error(ACCESS);
$form = new Forge(url::base(TRUE).url::current(TRUE));
$aro_groups_model = new Aro_group_Model();
$aro_groups = $aro_groups_model->select_list();
$users_aro_groups = $user->get_aro_groups_of_user($user_id);
$sel_groups = array();
foreach ($users_aro_groups as $aro)
$sel_groups[] = $aro->id;
$form->dropdown('groups[]')
->label('Aro groups')
->options($aro_groups)
->selected($sel_groups)
->multiple('multiple')
->size(20);
$form->submit('submit')
->value(__('Update'));
// form is validate
if ($form->validate())
{
$form_data = $form->as_array();
$groups = (isset($_POST["groups"])) ? $_POST["groups"] : array();
try
{
$aro_groups_model->transaction_start();
// cleans group - remove all old AROs
$aro_groups_model->clean_aro($user_id);
// inserts new AROs
$aro_groups_model->insert_groups($groups, $user_id);
$aro_groups_model->transaction_commit();
status::success('Access control groups of user has been successfully updated.');
}
catch (Exception $e)
{
$aro_groups_model->transaction_rollback();
Log::add_exception($e);
status::error('Error - cannot update access control groups.', $e);
}
url::redirect (url_lang::base().'users/show/'.$user_id);
}
$headline = __('Edit access control groups of user');
// breadcrumbs navigation
$breadcrumbs = breadcrumbs::add()
->link('members/show_all', 'Members',
$this->acl_check_view('Members_Controller','members'))
->disable_translation()
->link('members/show/' . $user->member->id,
"ID ".$user->member->id." - ".$user->member->name,
$this->acl_check_view(
'Members_Controller','members', $user->member->id
)
)->enable_translation()
->link('users/show_by_member/' . $user->member_id, 'Users',
$this->acl_check_view(
'Users_Controller', 'users', $user->member_id
)
)
->link('users/show/' . $user_id, "$user->name $user->surname ($user->login)",
$this->acl_check_view(
'Users_Controller', 'users', $user->member_id
)
)
->text($headline);
$view = new View('main');
$view->breadcrumbs = $breadcrumbs->html();
$view->title = $headline;
$view->content = new View('form');
$view->content->headline = $headline;
$view->content->form = $form;
$view->render(TRUE);
}
/**
* Deletes group
freenetis/branches/1.2/application/i18n/cs_CZ/texts.php
'about sms' => 'Informace o SMS',
'about e-mail message' => 'Informace o e-mailové zprávě',
'access control list items' => 'Položky seznamu pro řízení přístupu',
'access control groups of user has been successfully updated' => 'Přístupové skupiny uživatele byla úspěšně aktualizovány.',
'access control group of users has been successfully updated' => 'Přístupová skupina uživatelů byla úspěšně aktualizována.',
'access control groups of users' => 'Přístupové skupiny uživatelů',
'access control rule has been successfully added' => 'Přístupové pravidlo bylo úspěšně přidáno.',
......
'edit' => 'Upravit',
'edit %s' => 'Upravit %s',
'edit access control group of users' => 'Upravit přístupovou skupinu uživatelů',
'edit access control groups of user' => 'Upravit přístupové skupiny uživatele',
'edit access control rule' => 'Upravit přístupové pravidlo',
'edit access rights' => 'Upravit přístupová práva',
'edit account' => 'Upravit účet',
'edit address point' => 'Upravit adresní bod',
'edit admin of devices' => 'Upravit správce zařízení',
......
'error - cannot unset speed class as default' => 'Chyba - nelze zrušit třídu rychlosti jako výchozí.',
'error - cannot update %s' => 'Chyba - nelze uravit %s.',
'error - cannot update access control group' => 'Chyba - nelze aktualizovat přístupovou skupinu uživatelů',
'error - cannot update access control groups' => 'Chyba - nelze aktualizovat přístupové skupiny uživatele',
'error - cannot update allowed subnets of member' => 'Chyba - nelze aktualizovat povolené podsítě člena.',
'error - cannot update count of allowed subnets' => 'Chyba - nelze aktualizovat počet povolených podsítí.',
'error - cannot update device admin' => 'Chyba - nelze aktualizovat správce zařízení.',
freenetis/branches/1.2/application/models/aro_group.php
WHERE group_id = ?
", $group_id);
}
/**
* Cleans ARO - deletes all ARO groups
*
* @author David Raska
* @param integer $aro_id
*/
public function clean_aro ($aro_id)
{
if (!$aro_id)
return;
$this->db->query("
DELETE FROM groups_aro_map
WHERE aro_id = ?
", $aro_id);
}
/**
* Counts all childrens of given group
......
$this->db->query($sql_insert);
}
}
/**
* Inserts given groups to given ARO
*
* @author David Raska
* @param array $groups
* @param integer $aro_id
*/
public function insert_groups($groups = array(), $aro_id)
{
if (!$aro_id)
return;
$aro_id = intval($aro_id);
$sql_insert = "INSERT INTO groups_aro_map (group_id, aro_id) VALUES ";
$values = array();
foreach ($groups as $group)
$values[] = "(".intval($group).", $aro_id)";
if (count($values))
{
$sql_insert .= implode(',', $values);
$this->db->query($sql_insert);
}
}
}
freenetis/branches/1.2/application/vendors/axo_doc/axo_doc.xml
<axo usage_type="breadcrumbs" section="Aro_groups_Controller" value="aro_group" action="view" own="false"></axo>
<axo usage_type="breadcrumbs" section="Aro_groups_Controller" value="aro_group" action="view" own="false"></axo>
</method>
<method name="edit_user" comment-en="Edit users groups" comment-cs="Úprava skupin uživatele">
<axo usage_type="access" section="Aro_groups_Controller" value="aro_group" action="edit" own="true"></axo>
<axo usage_type="breadcrumbs" section="Members_Controller" value="members" action="view" own="false"></axo>
<axo usage_type="breadcrumbs" section="Members_Controller" value="members" action="view" own="true"></axo>
<axo usage_type="breadcrumbs" section="Users_Controller" value="users" action="view" own="true"></axo>
<axo usage_type="breadcrumbs" section="Users_Controller" value="users" action="view" own="true"></axo>
</method>
<method name="delete" comment-en="Delete an item" comment-cs="Odstranění položky">
<axo usage_type="access" section="Aro_groups_Controller" value="aro_group" action="delete" own="false"></axo>
</method>
......
<axo usage_type="links" section="Users_Controller" value="password" action="edit" own="true"></axo>
<axo usage_type="links" section="Users_Controller" value="application_password" action="edit" own="true"></axo>
<axo usage_type="links" section="Login_logs_Controller" value="logs" action="view" own="true"></axo>
<axo usage_type="links" section="Aro_groups_Controller" value="aro_group" action="edit" own="true"></axo>
<axo usage_type="access-partial" section="Users_Controller" value="application_password" action="view" own="true"></axo>
<axo usage_type="links" section="Users_Controller" value="additional_contacts" action="view" own="true"></axo>
<axo usage_type="links" section="Aro_groups_Controller" value="aro_group" action="view" own="false"></axo>
</object>
<object name="variable_symbols/edit" type="view"></object>
<object name="variable_symbols/show_by_account" type="view"></object>
freenetis/branches/1.2/application/views/users/show.php
if ($this->acl_check_view('Login_logs_Controller', 'logs', $user_data->member_id))
$links[] = html::anchor('login_logs/show_by_user/'.$user_data->id, __('Show login logs'));
if ($this->acl_check_edit('Aro_groups_Controller', 'aro_group', $user_data->member_id))
$links[] = html::anchor('aro_groups/edit_user/'.$user_data->id, __('Edit access rights'));
echo implode (' | ', $links);
......
<?php foreach ($aro_groups as $aro_group):?>
<tr>
<th><?php echo __('Group') ?></th>
<td><?php echo __(''.$aro_group->name) ?></td>
<td><?php echo ($this->acl_check_view('Aro_groups_Controller', 'aro_group') ? html::anchor('aro_groups/show/'.$aro_group->id, __(''.$aro_group->name)) : __(''.$aro_group->name)) ?></td>
</tr>
<?php endforeach; ?>
<tr>

Také k dispozici: Unified diff