</h2> <a href="<?php echo Url::to(['/aaa/user']); ?> "> <img style="width: 128px; height:128px;" src="<?php echo Url::to('@web/images/dash_users.png'); ?> " alt="Users"/> </a> </div> <?php } ?> <?php if (RbacController::can("reservation/read")) { ?> <div class="col-xs-6 col-sm-3" style="min-width: 250px"> <h2><?php echo Yii::t('home', 'Authorizations'); ?> </h2> <a href="<?php echo Url::to(['/circuits/authorization/index']); ?> "> <img style="width: 128px; height:128px;" src="<?php echo Url::to('@web/images/dash_authorizations.png'); ?> " alt="Authorizations"/> </a>
public function save() { $this->reservation = new Reservation(); $this->reservation->type = Reservation::TYPE_TEST; $this->reservation->name = Test::AT_PREFIX; $this->reservation->date = DateUtils::now(); $this->reservation->start = DateUtils::now(); $this->reservation->finish = DateUtils::now(); $this->reservation->bandwidth = 10; $this->reservation->requester_nsa = CircuitsPreference::findOneValue(CircuitsPreference::MEICAN_NSA); $this->reservation->provider_nsa = CircuitsPreference::findOneValue(CircuitsPreference::CIRCUITS_DEFAULT_PROVIDER_NSA); $this->reservation->request_user_id = Yii::$app->user->getId(); //Confere se usuário tem permissão para testar na origem OU no destino $source = Port::findOne(['id' => $this->src_port]); $destination = Port::findOne(['id' => $this->dst_port]); $permission = false; if ($source) { $source = $source->getDevice()->one(); if ($source) { $domain = $source->getDomain()->one(); if ($domain && RbacController::can('test/create', $domain->name)) { $permission = true; } } } if ($destination) { $destination = $destination->getDevice()->one(); if ($destination) { $domain = $destination->getDomain()->one(); if ($domain && RbacController::can('test/create', $domain->name)) { $permission = true; } } } if (!$permission) { Yii::$app->getSession()->addFlash("warning", Yii::t("circuits", "You are not allowed to create a automated test involving these selected domains")); return false; } if ($this->reservation->save()) { $this->reservation->name .= $this->reservation->id; $this->reservation->save(); $path = new ReservationPath(); $path->reservation_id = $this->reservation->id; $path->port_urn = Port::findOne($this->src_port)->urn; $path->path_order = 0; $path->vlan = $this->src_vlan; if (!$path->save()) { Yii::trace($path->getErrors()); return false; } $path = new ReservationPath(); $path->reservation_id = $this->reservation->id; $path->port_urn = Port::findOne($this->dst_port)->urn; $path->path_order = 1; $path->vlan = $this->dst_vlan; if (!$path->save()) { Yii::trace($path->getErrors()); return false; } $task = new ScheduledTask(); $task->freq = $this->cron_value; $task->obj_class = 'meican\\tester\\models\\Test'; $task->obj_data = $this->reservation->id; if (!$task->save()) { Yii::trace($task->getErrors()); return false; } } else { Yii::trace($this->reservation->getErrors()); return false; } return true; }
public function actionDelete() { if (isset($_POST["delete"])) { foreach ($_POST["delete"] as $testId) { $test = Test::findOne($testId); //Confere se usuário tem permissão para remover teste na origem OU no destino $source = $test->getSourceDomain()->one(); $destination = $test->getDestinationDomain()->one(); $permission = false; if ($source && RbacController::can('test/delete', $source->name)) { $permission = true; } if ($destination && RbacController::can('test/delete', $destination->name)) { $permission = true; } if (!$permission) { Yii::$app->getSession()->addFlash("warning", Yii::t("circuits", "You are not allowed to delete automated tests involving these selected domains")); } if (!$test->delete()) { Yii::$app->getSession()->addFlash("error", Yii::t("circuits", "Error deleting Automated Test")); } else { Yii::$app->getSession()->addFlash("success", Yii::t("circuits", "Automated Test deleted successfully")); } } } return $this->redirect('index'); }
<?php /** * @copyright Copyright (c) 2012-2016 RNP * @license http://github.com/ufrgs-hyman/meican#license */ use meican\base\widgets\Menu; use meican\aaa\RbacController; echo Menu::widget(['options' => ['class' => 'sidebar-menu'], 'items' => [['label' => Yii::t('home', 'Dashboard'), 'url' => ['/home'], 'icon' => 'fa fa-home'], ['label' => Yii::t('circuits', 'Circuits'), 'url' => '#', 'icon' => 'fa fa-calendar', 'items' => [['label' => Yii::t('circuits', 'Reserve'), 'url' => ['/circuits/reservation/create']], ['label' => Yii::t('circuits', 'Status'), 'url' => ['/circuits/reservation/status']], ['label' => Yii::t('circuits', 'Authorization'), 'url' => ['/circuits/authorization']], ['label' => Yii::t('circuits', 'Configuration'), 'url' => ['/circuits/config'], 'visible' => RbacController::can('configuration/read')]]], ['label' => Yii::t('bpm', 'Workflows'), 'url' => '#', 'icon' => 'fa fa-random', 'items' => [['label' => Yii::t('bpm', 'Create'), 'url' => ['/bpm/workflow/new'], 'visible' => RbacController::can('workflow/create')], ['label' => Yii::t('bpm', 'Status'), 'url' => ['/bpm/workflow']]], 'visible' => RbacController::can('workflow/read')], ['label' => Yii::t('monitoring', 'Monitoring'), 'url' => '#', 'icon' => 'fa fa-area-chart', 'items' => [['label' => Yii::t('bpm', 'Traffic'), 'url' => ['/monitoring']]]], ['label' => Yii::t('topology', 'Topologies'), 'url' => '#', 'icon' => 'fa fa-globe', 'items' => [['label' => Yii::t('topology', 'Domains'), 'url' => ['/topology/domain'], 'visible' => RbacController::can('domain/read')], ['label' => Yii::t('topology', 'Providers'), 'url' => ['/topology/provider'], 'visible' => RbacController::can('domain/read')], ['label' => Yii::t('topology', 'Networks'), 'url' => ['/topology/network'], 'visible' => RbacController::can('domainTopology/read')], ['label' => Yii::t('topology', 'Devices'), 'url' => ['/topology/device'], 'visible' => RbacController::can('domainTopology/read')], ['label' => Yii::t('topology', 'Ports'), 'url' => ['/topology/port'], 'visible' => RbacController::can('domainTopology/read')], ['label' => Yii::t('topology', 'Viewer'), 'url' => ['/topology/viewer'], 'visible' => RbacController::can("domainTopology/read") || RbacController::can("domain/read")], ['label' => Yii::t('topology', 'Discovery'), 'url' => ['/topology/discovery']]], 'visible' => RbacController::can('domainTopology/read') || RbacController::can('discovery/read')], ['label' => Yii::t('aaa', 'Tests'), 'url' => '#', 'icon' => 'fa fa-calendar-check-o', 'items' => [['label' => Yii::t('topology', 'Create'), 'url' => ['/tester/manager/create'], 'visible' => RbacController::can('test/create')], ['label' => Yii::t('topology', 'Status'), 'url' => ['/tester'], 'visible' => RbacController::can('test/read')]], 'visible' => RbacController::can('test/read') || RbacController::can('test/create')], ['label' => Yii::t('aaa', 'Users'), 'url' => '#', 'icon' => 'fa fa-users', 'items' => [['label' => Yii::t('aaa', 'Users'), 'url' => ['/aaa/user'], 'visible' => RbacController::can('user/read') || RbacController::can('role/read')], ['label' => Yii::t('aaa', 'Groups'), 'url' => ['/aaa/group'], 'visible' => RbacController::can('group/read')], ['label' => Yii::t('aaa', 'Configuration'), 'url' => ['/aaa/config'], 'visible' => RbacController::can('group/update')]]], ['label' => Yii::t('home', 'External Access'), 'url' => "#", 'icon' => 'fa fa-external-link', 'items' => [['label' => Yii::t('home', 'Console Central'), 'url' => 'http://monitora.cipo.rnp.br/console/', 'target' => '_blank']]]]]);
echo Yii::t("aaa", "Profile"); ?> </h3> <div class="box-tools"> <a href="<?php echo Url::to(["update", 'id' => $model->id]); ?> " class="btn btn-sm btn-default"><i class="fa fa-pencil"></i> Edit</a> </div> </div> <div class="box-body"> <?php echo $this->render("_profile", ['model' => $model]); ?> </div> </div> </div> <div class="col-md-6"> <?php echo $this->render("@meican/aaa/views/role/_domain", ['rolesProvider' => $domainRolesProvider, 'userId' => $model->id]); ?> <?php if (RbacController::can("user/read")) { echo $this->render("@meican/aaa/views/role/_system", ['rolesProvider' => $systemRolesProvider, 'userId' => $model->id]); } ?> </div> </div>