/* UIxUserLogoff.m - this file is part of SOGo
 *
 * Copyright (C) 2006 Inverse groupe conseil
 *
 * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
 *
 * This file is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This file is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#if LIB_FOUNDATION_LIBRARY
#  include <Foundation/exceptions/GeneralExceptions.h>
#elif NeXT_Foundation_LIBRARY || COCOA_Foundation_LIBRARY
#  include <NGExtensions/NGObjectMacros.h>
#  include <NGExtensions/NSString+Ext.h>
#endif

#include <NGExtensions/NGExtensions.h>
#include <NGObjWeb/NGObjWeb.h>
#include <NGObjWeb/SoObjects.h>

#include <SOGoUI/UIxComponent.h>

@interface UIxUserLogoff : UIxComponent
{
}

- (id) logoffUserAction;

@end

@implementation UIxUserLogoff

+ (void) initialize
{
  [[self soClassSecurityInfo] declareRole: SoRole_Anonymous
                              asDefaultForPermission: SoPerm_View];
}

- (id) logoffUserAction
{
  WOResponse *r;
  id auth, context;

//   context = [self context];
//   auth = [[self clientObject] authenticatorInContext: context];

//   [[self context] setActiveUser: nil];

  r = [[self context] response];
  [r setStatus: 302];
  [r setHeader: @"http://www.chnu.ca/"
     forKey: @"location"];
  [self reset];

//   return [auth unauthorized: @"Logoff" inContext: context];

  return r;
}

@end
