Revision 23ccba04 daemons/ganeti-rapi

b/daemons/ganeti-rapi
118 118

  
119 119
      req.private = ctx
120 120

  
121
    # Check for expected attributes
122
    assert req.private.handler
123
    assert req.private.handler_fn
124
    assert req.private.handler_access is not None
125

  
121 126
    return req.private
122 127

  
123
  def GetAuthRealm(self, req):
124
    """Override the auth realm for queries.
128
  def AuthenticationRequired(self, req):
129
    """Determine whether authentication is required.
125 130

  
126 131
    """
127
    ctx = self._GetRequestContext(req)
128
    if ctx.handler_access:
129
      return self.AUTH_REALM
130
    else:
131
      return None
132
    return bool(self._GetRequestContext(req).handler_access)
132 133

  
133 134
  def Authenticate(self, req, username, password):
134 135
    """Checks whether a user can access a resource.

Also available in: Unified diff