View for security page.
777847
def security():
    """"""
    sessions = SessionActivity.query_by_user(
        user_id=current_user.get_id()
    ).all()
    master_session = None
    for index, session in enumerate(sessions):
        if SessionActivity.is_current(session.sid_s):
            master_session = session
            del sessions[index]
    return render_template(
        current_app.config['ACCOUNTS_SETTINGS_SECURITY_TEMPLATE'],
        formclass=RevokeForm,
        sessions=[master_session] + sessions,
        is_current=SessionActivity.is_current
    )
449436
public function pagePermissionsAction()
    {

        $view = new ViewModel();
        //fixes rendering site's header and footer in the dialog
        $view->setTerminal(true);

        /** @var \Rcm\Entity\Site $currentSite */
        $currentSite = $this->getServiceLocator()->get(
            \Rcm\Service\CurrentSite::class
        );

        $currentSiteId = $currentSite->getSiteId();

        $sourcePageName = $this->getEvent()
            ->getRouteMatch()
            ->getParam(
                'rcmPageName',
                'index'
            );

        $pageType = $this->getEvent()
            ->getRouteMatch()
            ->getParam(
                'rcmPageType',
                'n'
            );

        /** @var ResourceName $resourceName */
        $resourceName = $this->getServiceLocator()->get(
            ResourceName::class
        );

        $resourceId = $resourceName->get(
            ResourceName::RESOURCE_SITES,
            $currentSiteId,
            ResourceName::RESOURCE_PAGES,
            $pageType,
            $sourcePageName
        );

        /** @var \RcmUser\Acl\Service\AclDataService $aclDataService */
        $aclDataService = $this->getServiceLocator()->get(
            \RcmUser\Acl\Service\AclDataService::class
        );

        //getting all set rules by resource Id
        $rules = $aclDataService->getRulesByResource($resourceId)->getData();

        //getting list of all dynamically created roles
        $allRoles = $aclDataService->getNamespacedRoles()->getData();

        $rolesHasRules = [];

        foreach ($rules as $setRuleFor) {
            //getting only the ones that are allow
            if ($setRuleFor->getRule() == 'allow') {
                $rolesHasRules[] = $setRuleFor->getRoleId();
            }
        }

        $selectedRoles = [];

        foreach ($allRoles as $key => $role) {
            $roleId = $role->getRoleId();
            if (in_array($roleId, $rolesHasRules)) {
                $selectedRoles[$roleId] = $role;
            }
        }

        $data = [
            'siteId' => $currentSiteId,
            'pageType' => $pageType,
            'pageName' => $sourcePageName,
            'roles' => $allRoles,
            'selectedRoles' => $selectedRoles,
        ];

        $view->setVariable('data', $data);

        $view->setVariable(
            'rcmPageName',
            $sourcePageName
        );
        $view->setVariable(
            'rcmPageType',
            $pageType
        );

        return $view;
    }
1160077
public function AdminPage()
	{
		$this->RequirePermission(ExampleUser::$PERMISSION_ADMIN, 
				'SecureExample.LoginForm', 
				'Login is required to access the admin page',
				'Admin permission is required to access the admin page');
		
		$this->Assign("currentUser", $this->GetCurrentUser());
		
		$this->Assign('page','adminpage');
		$this->Render("SecureExample");
	}
376350
private static void checkPermission() {
        SecurityManager security = System.getSecurityManager();
        if (security != null)
            security.checkPermission(modifyThreadPermission);
    }
902290
def security(self):
        """"""
        return {k: v for i in self.pdf.resolvedObjects.items() for k, v in i[1].items()}
150566
public function viewAction()
    {
        $this->checkAuth();

        /** @var Customer $customer */
        $customer   = $this->getSecurityContext()->getCustomerUser();
        $newsletter = NewsletterQuery::create()->findOneByEmail($customer->getEmail());
        $data       = array(
            'id'            => $customer->getId(),
            'title'         => $customer->getTitleId(),
            'firstname'     => $customer->getFirstName(),
            'lastname'      => $customer->getLastName(),
            'email'         => $customer->getEmail(),
            'email_confirm' => $customer->getEmail(),
            'lang_id'       => $customer->getLangId(),
            'newsletter'    => $newsletter instanceof Newsletter ? !$newsletter->getUnsubscribed() : false,
        );

        $customerProfileUpdateForm = $this->createForm(FrontForm::CUSTOMER_PROFILE_UPDATE, 'form', $data);

        // Pass it to the parser
        $this->getParserContext()->addForm($customerProfileUpdateForm);
    }
900599
public function viewLoginAction()
    {
        if ($this->getSecurityContext()->hasCustomerUser()) {
            // Redirect to home page
            return $this->generateRedirect(URL::getInstance()->getIndexPage());
        }

        return $this->render("login");
    }
1356142
public function viewPage()
    {
        $page = isset($_GET['sub']) ? (string)$_GET['sub'] : self::DEFAULT_SUB_PAGE;
        View::page('admin/' . $page);
    }
169077
def context(self):
        """"""
        stats = status_codes_by_date_stats()

        attacks_data = [{
            'type': 'line',
            'zIndex': 9,
            'name': _('Attacks'),
            'data': [(v[0], v[1]['attacks'])
                     for v in stats]
        }]

        codes_data = [{
            'zIndex': 4,
            'name': '2xx',
            'data': [(v[0], v[1][200]) for v in stats]
        }, {
            'zIndex': 5,
            'name': '3xx',
            'data': [(v[0], v[1][300]) for v in stats]
        }, {
            'zIndex': 6,
            'name': '4xx',
            'data': [(v[0], v[1][400]) for v in stats]
        }, {
            'zIndex': 8,
            'name': '5xx',
            'data': [(v[0], v[1][500]) for v in stats]
        }]

        return {'generic_chart': json.dumps(status_codes_by_date_chart()),
                'attacks_data': json.dumps(attacks_data),
                'codes_data': json.dumps(codes_data)}
132317
def show_ipsecpolicy(self, ipsecpolicy, **_params):
        """"""
        return self.get(self.ipsecpolicy_path % (ipsecpolicy), params=_params)
1332592
public function index() {        
        $action = Filter::post('action');        
        if($action == 'update' && Filter::checkCsrf()) $this->update();
        
        Theme::theme(new AdministrationTheme)->init(Globals::getTree());        
        $ctrl = new PageController();
        $ctrl
            ->restrictAccess(Auth::isAdmin())
            ->setPageTitle($this->module->getTitle());

        $view_bag = new ViewBag();
        $view_bag->set('title', $ctrl->getPageTitle());
        $view_bag->set('module', $this->module);
        
        ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render();
    }
1163916
def _show_loading_page(self):
        """"""
        self.shellwidget.hide()
        self.infowidget.show()
        self.info_page = self.loading_page
        self.set_info_page()
46286
def display(self):
        """"""
        self.command(SSD1306_COLUMNADDR)
        self.command(0)              # Column start address. (0 = reset)
        self.command(self.width-1)   # Column end address.
        self.command(SSD1306_PAGEADDR)
        self.command(0)              # Page start address. (0 = reset)
        self.command(self._pages-1)  # Page end address.
        for i in range(0, len(self._buffer), 16):
            control = 0x40   # Co = 0, DC = 0
            self._i2c.write_list(control, self._buffer[i:i+16])
300843
def index_view(request, auth_form=None, force_login=False, added_context=None):
    """"""
    if request.user.is_authenticated and not force_login:
        return dashboard_view(request)
    else:
        auth_form = auth_form or AuthenticateForm()
        request.session.set_test_cookie()

        fcps_emerg = get_fcps_emerg(request)

        try:
            login_warning = settings.LOGIN_WARNING
        except AttributeError:
            login_warning = None

        if fcps_emerg and not login_warning:
            login_warning = fcps_emerg

        ap_week = get_ap_week_warning(request)

        if ap_week and not login_warning:
            login_warning = ap_week

        events = Event.objects.filter(time__gte=datetime.now(), time__lte=(datetime.now().date() + relativedelta(weeks=1)), public=True).this_year()
        sports_events = events.filter(approved=True, category="sports").order_by('time')[:3]
        school_events = events.filter(approved=True, category="school").order_by('time')[:3]

        data = {
            "auth_form": auth_form,
            "request": request,
            "git_info": settings.GIT,
            "bg_pattern": get_bg_pattern(),
            "theme": get_login_theme(),
            "login_warning": login_warning,
            "senior_graduation": settings.SENIOR_GRADUATION,
            "senior_graduation_year": settings.SENIOR_GRADUATION_YEAR,
            "sports_events": sports_events,
            "school_events": school_events
        }
        schedule = schedule_context(request)
        data.update(schedule)
        if added_context is not None:
            data.update(added_context)
        return render(request, "auth/login.html", data)
985747
public function index()
    {
        $permissions = $this->permissions->all();

        return View::make(Config::get('cpanel::views.permissions_index'))
            ->with('permissions', $permissions);
    }
657681
def auth_view(name, **kwargs):
    
    ctx = Context(**kwargs)
    ctx.execute_action('auth:group:view', **{
        'storage': ctx.repo.create_secure_service('storage'),
        'name': name,
    })
1244194
def visible_for?(user)
      can_view_page = (
        if dropdown?
          true
        elsif menuable.kind_of?(Effective::Page)
          menuable.roles_permit?(user)
        else
          true
        end
      )

      can_view_menu_item = (
        if roles_mask == nil
          true
        elsif roles_mask == -1 # Am I logged out?
          user.blank?
        elsif roles_mask == 0 # Am I logged in?
          user.present?
        else
          roles_permit?(user)
        end
      )

      can_view_page && can_view_menu_item
    end