Requires the requestor to be a super user.
186520
def superuser_required(f):
    """"""
    @functools.wraps(f)
    @login_required
    def wrapped(*args, **kwargs):
        if not (current_user.is_authenticated() and current_user.superuser):
            abort(403)
        return f(*args, **kwargs)
    return wrapped
901386
def has_permission(self, perm):
        
        return self.user.superuser or self.auth.has_permission(perm)
1081291
private void checkSuperUser() throws AccessControlException {
    // collects user and groups
    String user = AuthenticatedClientUser.getClientUser(ServerConfiguration.global());
    List<String> groups = getGroups(user);
    if (!isPrivilegedUser(user, groups)) {
      throw new AccessControlException(ExceptionMessage.PERMISSION_DENIED
          .getMessage(user + " is not a super user or in super group"));
    }
  }
99347
def get(self, request, *args, **kwargs):
        """"""
        kwargs['pk'] = request.user.id
        self.kwargs['pk'] = request.user.id
        return super().get(request, *args, **kwargs)
586973
function requireAuthorization(handler) {
  return function(request, response, store, parameters) {
    var handlerArguments = arguments
    var publisher = parameters.publisher
    var authorization = request.headers.authorization
    if (authorization) {
      var parsed = parseAuthorization(authorization)
      if (parsed === false || parsed.user !== publisher) {
        respond401(response) }
      else {
        checkPassword(publisher, parsed.password, function(error, valid) {
          if (error) {
            respond500(request, response, error) }
          else {
            if (valid) {
              handler.apply(this, handlerArguments) }
            else {
              respond401(response) } } }) } }
    else {
      respond401(response) } } }
943624
def user_in_any_group(user, groups):
    """"""
    return user_is_superuser(user) or any(user_in_group(user, group) for group in groups)
476668
def has_project_permissions(user: 'User', project: 'Project', request_method: str) -> bool:
    """"""
    # Superusers and the creator is allowed to do everything
    if user.is_staff or user.is_superuser or project.user == user:
        return True

    # Other user
    return request_method in permissions.SAFE_METHODS and project.is_public
607991
public boolean needAuthorization(ResponseEvent event) {
    Response response = event.getResponse();
    int status = response.getStatusCode();

    if ((status == Response.UNAUTHORIZED) || (status == Response.PROXY_AUTHENTICATION_REQUIRED)) {
      return true;
    }

    return false;
  }
920627
def superuser_required(view_func):
    
    @wraps(view_func)
    def _checklogin(request, *args, **kwargs):
        if request.user.is_active and request.user.is_superuser:
            # The user is valid. Continue to the admin page.
            return view_func(request, *args, **kwargs)

        assert hasattr(request, 'session'), "The Django admin requires session middleware to be installed. Edit your MIDDLEWARE_CLASSES setting to insert 'django.contrib.sessions.middleware.SessionMiddleware'."
        defaults = {
            'template_name': 'admin/login.html',
            'redirect_field_name': request.get_full_path(),
            'authentication_form': AdminAuthenticationForm,
            'extra_context': {
                'title': _('Log in'),
                'app_path': request.get_full_path()
                }
            }
        return LoginView(request, **defaults)
    return _checklogin
1263092
def require_super_admin
      unless @current_user.super_admin?
        text = "#{I18n.t("authentication.permission_denied.heading")}: #{I18n.t("authentication.permission_denied.message")}"
        set_flash_message(text, :error, false) if defined?(flash) && flash
        redirect_or_popup_to_default_sign_in_page(false)
      end
    end
632919
def create_superuser(self, email, password, **extra_fields):
        """"""
        extra_fields.setdefault('is_staff', True)
        extra_fields.setdefault('is_superuser', True)
        if extra_fields.get('is_staff') is not True:
            raise ValueError('Superuser must have is_staff=True.')
        if extra_fields.get('is_superuser') is not True:
            raise ValueError('Superuser must have is_superuser=True.')
        return self._create_user(email, password, **extra_fields)
209832
def topoff_user(cls, user, amount):
        
        stat, _ = cls.objects.get_or_create(user=user)
        remaining = stat.invites_remaining()
        if remaining != -1 and remaining < amount:
            stat.invites_allocated += (amount - remaining)
            stat.save()
909870
def is_editable(self, request):
        
        return request.user.is_superuser or request.user.id == self.user_id
376043
public function hasSuperUser()
    {

        $permissions = $this->getAllPermissions();

        foreach ($permissions as $permission)
            if ($permission === 'superuser') return true;

        return false;
    }
1026327
def has_permission(self, request):
        
        if not super(AdminSiteOTPRequiredMixin, self).has_permission(request):
            return False
        return request.user.is_verified()
267514
def is_super_admin(self, req):
        
        return req.headers.get('x-auth-admin-user') == '.super_admin' and \
            self.super_admin_key and \
            req.headers.get('x-auth-admin-key') == self.super_admin_key
276959
function addUser(req, res, next) {
  res.locals.user = req.user;
  next();
}