Checks if the considered user has given permission for the passed forum.
765445
def has_perm(self, perm, forum):
        
        if not self.user.is_anonymous and not self.user.is_active:
            # An inactive user cannot have permissions
            return False
        elif self.user and self.user.is_superuser:
            # The superuser have all permissions
            return True
        return perm in self.get_perms(forum)
375663
def has_permission(self, request, *args, **kwargs):
        
        self.kwargs = kwargs
        self.args = args
        self.request = request

        if not getattr(self, 'permission', None):
            return True
        else:
            return request.user.has_perm(self.permission)
575520
def check_permission(self, request, page, permission):
        
        if not getattr(page, "can_" + permission)(request):
            raise PermissionDenied
401817
def perform_permissions_check(self, user, obj, perms):
        
        return self.request.forum_permission_handler.can_delete_post(obj, user)
732996
def check_read_permission(self, user_id, do_raise=True):
        
        if _is_admin(user_id):
            return True

        if int(self.created_by) == int(user_id):
            return True

        for owner in self.owners:
            if int(owner.user_id) == int(user_id):
                if owner.view == 'Y':
                    break
        else:
            if do_raise is True:
                raise PermissionError("Permission denied. User %s does not have read"
                             " access on network %s" %
                             (user_id, self.id))
            else:
                return False

        return True
1157871
def has_permission(user, permission_name):
    """"""
    if user and user.is_superuser:
        return True

    return permission_name in available_perm_names(user)
600569
def has_access?(permission, user)
      raise UnknownUserException if user.nil?

      AccessProvider.action_permitted_for_user?(permission, user)
    end
219285
public boolean hasPermissionForUser(String user, List<String> permission) {
        return hasPermissionForUser(user, permission.toArray(new String[0]));
    }
813871
def has_permission(self):
        """"""
        objs = [None]
        if hasattr(self, 'get_perms_objects'):
            objs = self.get_perms_objects()
        else:
            if hasattr(self, 'get_object'):
                try:
                    objs = [self.get_object()]
                except Http404:
                    raise
                except:
                    pass
            if objs == [None]:
                objs = self.get_queryset()

        if (hasattr(self, 'permission_filter_queryset') and
           self.permission_filter_queryset is not False and
           self.request.method == 'GET'):
            if objs != [None]:
                self.perms_filter_queryset(objs)
            return True
        else:
            return check_perms(self.request.user,
                               self.get_permission_required(),
                               objs, self.request.method)
525879
def has_permission(self, request, view):
        
        if request.method == 'POST':
            user = Profile.objects.only('id', 'username').get(username=view.kwargs['username'])
            return request.user.id == user.id

        return True
165221
def has_permission(self, *args, **kwargs):
        """"""
        def wrapper(view):
            if getattr(view, '_has_permissions_decorator', False) is True:
                return view

            @wraps(view)
            @jsonapi_exception_formatter
            def decorated(*view_args, **view_kwargs):
                self.check_permissions(view, view_args, view_kwargs, *args, **kwargs)
                return view(*view_args, **view_kwargs)
            decorated._has_permissions_decorator = True
            return decorated
        return wrapper
883381
def has_access(self, permission_name, view_name):
        
        if current_user.is_authenticated:
            return self._has_view_access(g.user, permission_name, view_name)
        elif current_user_jwt:
            return self._has_view_access(current_user_jwt, permission_name, view_name)
        else:
            return self.is_item_public(permission_name, view_name)
999551
def _check_view_permission(self, view):
        
        security = get_service("security")
        return security.has_permission(current_user, view.permission, self.obj)
926398
def perform_permissions_check(self, user, obj, perms):
        
        return self.request.forum_permission_handler.can_access_moderation_queue(user)
663864
def check_perms(perms, user, slug, raise_exception=False):
    """"""
    if isinstance(perms, string_types):
        perms = {perms}
    else:
        perms = set(perms)

    allowed_users = ACLRule.get_users_for(perms, slug)

    if allowed_users:
        return user in allowed_users

    if perms.issubset(set(WALIKI_ANONYMOUS_USER_PERMISSIONS)):
        return True

    if is_authenticated(user) and perms.issubset(set(WALIKI_LOGGED_USER_PERMISSIONS)):
        return True

    # First check if the user has the permission (even anon users)
    if user.has_perms(['waliki.%s' % p for p in perms]):
        return True
    # In case the 403 handler should be called raise the exception
    if raise_exception:
        raise PermissionDenied
    # As the last resort, show the login form
    return False
793869
def has_permission(self, request, view):
        
        has_permission = False
        if request.method == "GET" \
                or request.method in ["PUT", "POST", "DELETE"] \
                and request.user and request.user.is_superuser:
            has_permission = True
        return has_permission
585324
def editpermissions_user_view(self, request, user_id, forum_id=None):
        
        user_model = get_user_model()
        user = get_object_or_404(user_model, pk=user_id)
        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'), user)
        context['form'] = self._get_permissions_form(
            request, UserForumPermission, {'forum': forum, 'user': user},
        )

        return render(request, self.editpermissions_user_view_template_name, context)