This decorator sets this view to have restricted permissions.
345815
def dispatch(self, *args, **kwargs):
        """"""
        return super(AnimalMonthArchive, self).dispatch(*args, **kwargs)
408679
public void setDisabled(boolean disabled) {

        m_disabled = disabled;
        if (m_disabled) {
            getListItemWidget().addStyleName(I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().hiddenNavEntry());
        } else {
            getListItemWidget().removeStyleName(I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().hiddenNavEntry());
        }
    }
357739
def add_view_permissions(sender, verbosity, **kwargs):
    
    from django.contrib.contenttypes.models import ContentType
    from django.contrib.auth.models import Permission

    for content_type in ContentType.objects.all():
        codename = "view_%s" % content_type.model

        _, created = Permission.objects \
            .get_or_create(content_type=content_type,
                           codename=codename,
                           defaults={'name': 'Can view %s' % content_type.name})
        if created and verbosity >= 1:
            print('Added view permission for %s' % content_type.name)
1296752
def restrict_chat_member(self, *args, **kwargs):
        """"""
        return restrict_chat_member(*args, **self._merge_overrides(**kwargs)).run()
1089404
def has_permission(self, request, view):
        
        url_username = request.parser_context.get('kwargs', {}).get('username', '')
        if request.user.username.lower() != url_username.lower():
            if request.user.is_staff:
                return False  # staff gets 403
            raise Http404()
        return True
1273597
def editpermissions_anonymous_user_view(self, request, forum_id=None):
        
        forum = get_object_or_404(Forum, pk=forum_id) if forum_id else None

        # Set up the context
        context = self.get_forum_perms_base_context(request, forum)
        context['forum'] = forum
        context['title'] = '{} - {}'.format(_('Forum permissions'), _('Anonymous user'))
        context['form'] = self._get_permissions_form(
            request, UserForumPermission, {'forum': forum, 'anonymous_user': True},
        )

        return render(request, self.editpermissions_anonymous_user_view_template_name, context)
387736
private function setPermissions()
    {
        $this->pluginsService->savePluginPermissions($this->pluginsService->collectPermissions($this->translator->trans('plugin.ingest.permissions.label')));
    }
1252475
def unauthorized_view(self):
        
        # Prepare Flash message
        url = request.script_root + request.path
        flash(_("You do not have permission to access '%(url)s'.", url=url), 'error')

        # Redirect to USER_UNAUTHORIZED_ENDPOINT
        return redirect(self._endpoint_url(self.USER_UNAUTHORIZED_ENDPOINT))
426053
def is_allowed_view(perm):
    """"""

    # Check if permission is in excluded list
    for view in ACL_EXCLUDED_VIEWS:
        module, separator, view_name = view.partition('*')
        if view and perm.startswith(module):
            return False

    # Check if permission is in acl list
    for view in ACL_ALLOWED_VIEWS:
        module, separator, view_name = view.partition('*')
        if separator and not module and not view_name:
            return True
        elif separator and module and perm.startswith(module):
            return True
        elif separator and view_name and perm.endswith(view_name):
            return True
        elif not separator and view == perm:
            return True
    return False
381293
function canHide( )
    {
        if ( !isset( $this->Permissions["can_hide"] ) )
        {
            $this->Permissions["can_hide"] = $this->checkAccess( 'hide' );
        }
        return ( $this->Permissions["can_hide"] == 1 );
    }
1289418
def show_form_for_method(self, view, method, request, obj):
        
        if method not in view.allowed_methods:
            return  # Not a valid method

        try:
            view.check_permissions(request)
            if obj is not None:
                view.check_object_permissions(request, obj)
        except exceptions.APIException:
            return False  # Doesn't have permissions
        return True
1155445
def _view(self, request, extra_context=None):
        
        if not self.has_permission(request.user):
            raise PermissionDenied

        return self.view(request, self.construct_context(request))
1105764
def _set_operable_view(self, session):
        """"""
        for obj_name in self._operable_views:
            if self._operable_views[obj_name] == ACTIVE:
                try:
                    getattr(session, 'use_active_' + obj_name + '_view')()
                except AttributeError:
                    pass
            else:
                try:
                    getattr(session, 'use_any_status_' + obj_name + '_view')()
                except AttributeError:
                    pass
621859
def permitted_to? (privilege, options = {}, &block)
      options = {
        :user =>  Authorization.current_user,
        :object => self
      }.merge(options)
      Authorization::Engine.instance.permit?(privilege,
          {:user => options[:user],
           :object => options[:object]},
          &block)
    end
571483
private boolean isRestricted(Permission permission) {
        for (Permission restrictedPermission : restrictablePermissions) {
            if (restrictedPermission.implies(permission)) {
                return true;
            }
        }
        return false;
    }
885779
def set_public_limits(self):
        
        if self.request.method.upper() in ['GET', 'HEAD']:
            self._query_params.process_int_param('_limit', 20)
        if self._auth_enabled and not getattr(self.request, 'user', None):
            wrappers.set_public_limits(self)
1338616
public PermissionsBuilder setAllowed(PermissionType... types) {
        for (PermissionType type : types) {
            setState(type, PermissionState.ALLOWED);
        }
        return this;
    }