Commit 2ffdd2dd authored by claes's avatar claes

wb_login moved to co

parent 971c8d95
/*
* Proview $Id: wb_foe_gtk.cpp,v 1.11 2007-09-26 11:51:46 claes Exp $
* Proview $Id: wb_foe_gtk.cpp,v 1.12 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -44,7 +44,7 @@
#include "wb_watt_gtk.h"
#include "wb_gre_gtk.h"
#include "wb_foe_gtk.h"
#include "wb_login.h"
#include "co_login.h"
#include "wb_pal_gtk.h"
#include "wb_nav_gtk.h"
#include "co_wow_gtk.h"
......@@ -1769,7 +1769,7 @@ pwr_tStatus WFoeGtk::create_window( int x_top,
XtUnmanageChild(widgets.textinput);
if ( !(login_prv.priv & pwr_mPrv_DevPlc ) ||
if ( !(CoLogin::privilege() & pwr_mPrv_DevPlc ) ||
(function_access == foe_eFuncAccess_View)) {
/* Mode Edit and Simulate is not allowed */
i=0;
......
/*
* Proview $Id: wb_vsel_gtk.cpp,v 1.1 2007-01-04 07:29:02 claes Exp $
* Proview $Id: wb_vsel_gtk.cpp,v 1.2 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -39,8 +39,8 @@
#include "wb_foe.h"
#include "wb_utl_api.h"
#include "wb_lfu.h"
#include "wb_login.h"
#include "wb_login_msg.h"
#include "co_login.h"
#include "co_login_msg.h"
#include "wb_foe_msg.h"
#include "wb_ldh_msg.h"
#include "co_msgwindow.h"
......
/*
* Proview $Id: wb_wnav_gtk.cpp,v 1.2 2007-05-16 07:42:20 claes Exp $
* Proview $Id: wb_wnav_gtk.cpp,v 1.3 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -35,7 +35,6 @@ extern "C" {
#include "wb_wnav_msg.h"
#include "wb_ldh_msg.h"
#include "wb_ldh.h"
#include "wb_login.h"
#include "wb_wccm.h"
}
......@@ -47,6 +46,7 @@ extern "C" {
#include "wb_wnav_gtk.h"
#include "wb_wnav_item.h"
#include "co_wow_gtk.h"
#include "co_login_gtk.h"
#include "wb_wge_gtk.h"
#include "ge_gtk.h"
#include "wb_wda_gtk.h"
......@@ -385,6 +385,15 @@ void WNavGtk::wda_new( pwr_tOid oid, pwr_tCid cid, char *attribute,
advuser, display_objectname);
}
CoLogin *WNavGtk::login_new( char *name,
char *groupname,
void (* bc_success)( void *),
void (* bc_cancel)( void *),
pwr_tStatus *status)
{
return new CoLoginGtk( this, parent_wid, name, groupname, bc_success, bc_cancel, status);
}
void WNavGtk::wge_subwindow_loop( WGe *wge)
{
gtk_main();
......
/*
* Proview $Id: wb_wnav_gtk.h,v 1.1 2007-01-04 07:29:02 claes Exp $
* Proview $Id: wb_wnav_gtk.h,v 1.2 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -24,6 +24,8 @@
/* wtt_wnav_gtk.h -- Simple navigator */
class CoLogin;
class WNavGtk : public WNav {
public:
WNavGtk(
......@@ -72,6 +74,8 @@ class WNavGtk : public WNav {
void wge_modal_loop( WGe *wge);
bool has_window() {return parent_wid ? true : false;}
wb_utl *utl_new();
CoLogin *login_new( char *name, char *groupname,
void (* bc_success)( void *), void (* bc_cancel)( void *), pwr_tStatus *status);
static void trace_scan( WNavGtk *wnav);
static void sel_lose_cb( GtkWidget *w, GdkEventSelection *event,
......
/*
* Proview $Id: wb_wtt_gtk.cpp,v 1.23 2008-02-27 06:29:51 claes Exp $
* Proview $Id: wb_wtt_gtk.cpp,v 1.24 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -33,7 +33,6 @@
#include "co_wow.h"
#include "wb_utl_api.h"
#include "wb_lfu.h"
#include "wb_login.h"
#include "rt_load.h"
#include "wb_foe_msg.h"
#include "wb_pwrb_msg.h"
......@@ -870,6 +869,8 @@ void WttGtk::activate_command( GtkWidget *w, gpointer data)
return;
}
gtk_editable_delete_text( GTK_EDITABLE(((WttGtk *)wtt)->cmd_input), 0, -1);
if ( wtt->input_open)
wtt->input_open = 0;
else
......@@ -881,7 +882,6 @@ void WttGtk::activate_command( GtkWidget *w, gpointer data)
((WttGtk *)wtt)->cmd_entry->set_recall_buffer( &cmd_recall);
gtk_widget_grab_focus( ((WttGtk *)wtt)->cmd_input);
gtk_editable_delete_text( GTK_EDITABLE(((WttGtk *)wtt)->cmd_input), 0, -1);
wtt->command_open = 1;
}
......
/*
* Proview $Id: wb_foe_motif.cpp,v 1.1 2007-01-04 07:29:02 claes Exp $
* Proview $Id: wb_foe_motif.cpp,v 1.2 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -50,7 +50,7 @@
#include "wb_watt_motif.h"
#include "wb_gre_motif.h"
#include "wb_foe_motif.h"
#include "wb_login.h"
#include "co_login.h"
#include "co_mrm_util.h"
#include "wb_nav_motif.h"
#include "wb_pal_motif.h"
......@@ -1330,7 +1330,7 @@ pwr_tStatus WFoeMotif::create_window( int x_top,
XtUnmanageChild(widgets.textinput);
if ( !(login_prv.priv & pwr_mPrv_DevPlc ) ||
if ( !(CoLogin::privilege() & pwr_mPrv_DevPlc ) ||
(function_access == foe_eFuncAccess_View)) {
/* Mode Edit and Simulate is not allowed */
i=0;
......
/*
* Proview $Id: wb_vsel_motif.cpp,v 1.1 2007-01-04 07:29:02 claes Exp $
* Proview $Id: wb_vsel_motif.cpp,v 1.2 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -48,8 +48,8 @@
#include "wb_foe.h"
#include "wb_utl_api.h"
#include "wb_lfu.h"
#include "wb_login.h"
#include "wb_login_msg.h"
#include "co_login.h"
#include "co_login_msg.h"
#include "wb_foe_msg.h"
#include "wb_ldh_msg.h"
#include "co_msgwindow.h"
......
/*
* Proview $Id: wb_wnav_motif.cpp,v 1.1 2007-01-04 07:29:02 claes Exp $
* Proview $Id: wb_wnav_motif.cpp,v 1.2 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -33,7 +33,6 @@
#include "wb_wnav_msg.h"
#include "wb_ldh_msg.h"
#include "wb_ldh.h"
#include "wb_login.h"
#include "wb_wccm.h"
#include <Xm/Xm.h>
......@@ -59,6 +58,7 @@
#include "flow_x.h"
#include "co_wow_motif.h"
#include "co_login_motif.h"
#include "wb_wge_motif.h"
#include "ge_motif.h"
#include "wb_utl_motif.h"
......@@ -447,6 +447,15 @@ void WNavMotif::wda_new( pwr_tOid oid, pwr_tCid cid, char *attribute,
advuser, display_objectname);
}
CoLogin *WNavMotif::login_new( char *name,
char *groupname,
void (* bc_success)( void *),
void (* bc_cancel)( void *),
pwr_tStatus *status)
{
return new CoLoginMotif( this, parent_wid, name, groupname, bc_success, bc_cancel, status);
}
void WNavMotif::wge_subwindow_loop( WGe *wge)
{
XEvent Event;
......
/*
* Proview $Id: wb_wnav_motif.h,v 1.1 2007-01-04 07:29:02 claes Exp $
* Proview $Id: wb_wnav_motif.h,v 1.2 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -24,6 +24,8 @@
/* wtt_wnav_motif.h -- Simple navigator */
class CoLogin;
class WNavMotif : public WNav {
public:
WNavMotif(
......@@ -71,6 +73,8 @@ class WNavMotif : public WNav {
void wge_modal_loop( WGe *wge);
bool has_window() {return parent_wid ? true : false;}
wb_utl *utl_new();
CoLogin *login_new( char *name, char *groupname,
void (* bc_success)( void *), void (* bc_cancel)( void *), pwr_tStatus *status);
static void trace_scan( WNavMotif *wnav);
static void sel_lose_cb( Widget w, Atom *selection);
......
/*
* Proview $Id: wb_wtt_motif.cpp,v 1.1 2007-01-04 07:29:02 claes Exp $
* Proview $Id: wb_wtt_motif.cpp,v 1.2 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -57,7 +57,6 @@ extern "C" {
#include "co_mrm_util.h"
#include "wb_utl_api.h"
#include "wb_lfu.h"
#include "wb_login.h"
#include "rt_load.h"
#include "wb_foe_msg.h"
#include "wb_pwrb_msg.h"
......
/*
* Proview $Id: wb_c_classvolumeconfig.cpp,v 1.2 2007-12-21 13:18:01 claes Exp $
* Proview $Id: wb_c_classvolumeconfig.cpp,v 1.3 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -31,7 +31,7 @@
#include "wb_pwrs.h"
#include "wb_ldh_msg.h"
#include "wb_ldh.h"
#include "wb_login.h"
#include "co_login.h"
#include "co_cdh.h"
#include "co_dcli.h"
#include "wb_wnav.h"
......@@ -79,7 +79,7 @@ static pwr_tStatus EditClassVolume (
dcli_translate_filename( filename, "$pwr_exe/wb_open_db.sh");
sprintf( cmd,
"%s \"%s\" \"%s\" \"%s\" \"%s\" &",
filename, login_prv.username, login_prv.password, name, name);
filename, CoLogin::username(), CoLogin::ucpassword(), name, name);
sts = system( cmd);
if ( sts == -1 || sts == 127) {
......
/*
* Proview $Id: wb_c_dbconfig.cpp,v 1.1 2007-01-04 07:29:03 claes Exp $
* Proview $Id: wb_c_dbconfig.cpp,v 1.2 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -32,7 +32,7 @@
#include "wb_ldh_msg.h"
#include "wb_ldh.h"
#include "wb_utl_api.h"
#include "wb_login.h"
#include "co_login.h"
#include "co_cdh.h"
#include "co_dcli.h"
......@@ -65,7 +65,7 @@ static pwr_tStatus OpenDb (
sprintf( cmd,
"@pwr_exe:wb_open_db \"%s\" \"%s\" \"%s\" \"\" \"%s\"",
db_id, login_prv.username, login_prv.password, name);
db_id, CoLogin::username(), CoLogin::uspassword(), name);
free( db_id);
sts = lib$spawn (&cmd_desc , 0 , 0 , &cli_flag );
......@@ -95,7 +95,7 @@ static pwr_tStatus OpenDb (
cdh_ToLower( db_id, db_id_p);
sprintf( cmd,
"%s \"%s\" \"%s\" \"%s\" \"\" \"%s\" &",
filename, db_id, login_prv.username, login_prv.password, name);
filename, db_id, CoLogin::username(), CoLogin::ucpassword(), name);
free( db_id_p);
sts = system( cmd);
......
/*
* Proview $Id: wb_c_node.cpp,v 1.2 2007-05-16 12:40:04 claes Exp $
* Proview $Id: wb_c_node.cpp,v 1.3 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -33,6 +33,8 @@ static pwr_tStatus PostCreate (
pwr_tClassId cid;
pwr_tStatus sts;
sts = ldh_CreateObject(Session, &oid, "Security", pwr_eClass_Security, Object, ldh_eDest_IntoLast);
sts = ldh_ClassNameToId(Session, &cid, "MessageHandler");
sts = ldh_CreateObject(Session, &oid, "MessageHandler", cid, Object, ldh_eDest_IntoLast);
......
/*
* Proview $Id: wb_c_object.cpp,v 1.3 2007-12-06 10:55:04 claes Exp $
* Proview $Id: wb_c_object.cpp,v 1.4 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -29,7 +29,7 @@
#include "co_dcli.h"
#include "co_api.h"
#include "wb_wtt.h"
#include "wb_login.h"
#include "co_login.h"
static pwr_tStatus CopyObject (
ldh_sMenuCall *ip
......@@ -954,7 +954,7 @@ static pwr_tStatus ConfigureComponentFilter( ldh_sMenuCall *ip)
// Common Build filter
static pwr_tStatus BuildFilter( ldh_sMenuCall *ip)
{
if ( login_prv.priv & pwr_mPrv_DevConfig)
if ( CoLogin::privilege() & pwr_mPrv_DevConfig)
return 1;
else
return 0;
......
/*
* Proview $Id: wb_c_projectreg.cpp,v 1.2 2007-04-26 12:38:12 claes Exp $
* Proview $Id: wb_c_projectreg.cpp,v 1.3 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -27,7 +27,7 @@
#include "wb_ldh_msg.h"
#include "wb_ldh.h"
#include "wb_pwrb_msg.h"
#include "wb_login.h"
#include "co_login.h"
/*----------------------------------------------------------------------------*\
......@@ -53,7 +53,7 @@ static pwr_tStatus OpenProject (
dcli_translate_filename( fname, "$pwr_exe/wb_pvd_pl.sh");
sprintf( cmd,
"%s opendb \"%s\" \"%s\" \"%s\" &",
fname, project, login_prv.username, login_prv.password);
fname, project, CoLogin::username(), CoLogin::ucpassword());
free( project);
......
/*
* Proview $Id: wb_c_rootvolumeconfig.cpp,v 1.1 2007-01-04 07:29:03 claes Exp $
* Proview $Id: wb_c_rootvolumeconfig.cpp,v 1.2 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -31,7 +31,7 @@
#include "wb_pwrs.h"
#include "wb_ldh_msg.h"
#include "wb_ldh.h"
#include "wb_login.h"
#include "co_login.h"
#include "co_cdh.h"
#include "co_dcli.h"
......@@ -57,7 +57,7 @@ static pwr_tStatus OpenDb (
dcli_translate_filename( filename, "$pwr_exe/wb_open_db.sh");
sprintf( cmd,
"%s \"%s\" \"%s\" \"%s\" \"%s\" &",
filename, login_prv.username, login_prv.password, volume_name, volume_name);
filename, CoLogin::username(), CoLogin::ucpassword(), volume_name, volume_name);
sts = system( cmd);
if ( sts == -1 || sts == 127) {
......
/*
* Proview $Id: wb_foe.cpp,v 1.9 2008-05-29 14:57:53 claes Exp $
* Proview $Id: wb_foe.cpp,v 1.10 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -37,7 +37,7 @@
#include "wb_ldh.h"
#include "wb_foe_msg.h"
#include "wb_vldh_msg.h"
#include "wb_login_msg.h"
#include "co_login_msg.h"
#include "wb_gcg.h"
#include "wb_goen.h"
#include "wb_gre.h"
......@@ -45,7 +45,7 @@
#include "wb_foe.h"
#include "wb_gsx.h"
#include "wb_utl_api.h"
#include "wb_login.h"
#include "co_login.h"
#include "wb_tra.h"
#include "wb_watt.h"
#include "wb_gobj.h"
......@@ -2574,7 +2574,7 @@ int WFoe::new_local( pwr_tObjid plcprogram,
/* This is a brandnew plcprogram */
/* Check authorization to open a new plcpgm */
if ( !(login_prv.priv & pwr_mPrv_DevPlc )) {
if ( !(CoLogin::privilege() & pwr_mPrv_DevPlc )) {
return LOGIN__USERNOTAU;
}
access = ldh_eAccess_ReadWrite;
......@@ -3352,7 +3352,7 @@ int WFoe::change_mode( int new_mode)
}
break;
case EDIT:
if ( !(login_prv.priv & pwr_mPrv_DevPlc )) {
if ( !(CoLogin::privilege() & pwr_mPrv_DevPlc )) {
message( "No privilege to enter Edit");
BEEP;
set_mode_button_state( EDIT, 0);
......@@ -3484,7 +3484,7 @@ int WFoe::change_mode( int new_mode)
break;
case SIMULATE:
if ( !(login_prv.priv & pwr_mPrv_DevPlc )) {
if ( !(CoLogin::privilege() & pwr_mPrv_DevPlc )) {
message( "No privilege to enter Simulate");
BEEP;
set_mode_button_state( SIMULATE, 0);
......
/*
* Proview $Id: wb_uted.cpp,v 1.1 2007-01-04 07:29:04 claes Exp $
* Proview $Id: wb_uted.cpp,v 1.2 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -25,7 +25,6 @@
#include <string.h>
#include "pwr.h"
#include "wb_login.h"
#include "flow_ctx.h"
#include "co_time.h"
#include "co_msg.h"
......
/*
* Proview $Id: wb_vsel.cpp,v 1.17 2008-02-27 06:32:41 claes Exp $
* Proview $Id: wb_vsel.cpp,v 1.18 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -42,8 +42,8 @@
#include "wb_utl_api.h"
#include "wb_lfu.h"
#include "co_wow.h"
#include "wb_login.h"
#include "wb_login_msg.h"
#include "co_login.h"
#include "co_login_msg.h"
#include "wb_foe_msg.h"
#include "wb_ldh_msg.h"
#include "co_msgwindow.h"
......@@ -262,7 +262,7 @@ pwr_tStatus WVsel::check_volumelist(
error_count = 0;
*display_window = 0;
if ( !(login_prv.priv & pwr_mPrv_DevConfig ))
if ( !(CoLogin::privilege() & pwr_mPrv_DevConfig ))
// No privileges for edit, don't check the volumes
return 1;
......
/*
* Proview $Id: wb_wblnode.cpp,v 1.60 2007-12-06 10:53:18 claes Exp $
* Proview $Id: wb_wblnode.cpp,v 1.61 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -252,6 +252,8 @@ static wbl_sSym classes[] =
,{ "pwr_eCix_Hier", pwr_eCix_Hier }
,{ "pwr_eClass_ClassLost", pwr_eClass_ClassLost }
,{ "pwr_eCix_ClassLost", pwr_eCix_ClassLost }
,{ "pwr_eClass_Security", pwr_eClass_Security }
,{ "pwr_eCix_Security", pwr_eCix_Security }
,{ 0, 0 }
};
......@@ -324,6 +326,7 @@ static wbl_sSym attr_flags[] =
,{ "pwr_mClassDef_IORack", pwr_mClassDef_IORack }
,{ "pwr_mClassDef_IOCard", pwr_mClassDef_IOCard }
,{ "pwr_mClassDef_HasCallBack", pwr_mClassDef_HasCallBack }
,{ "pwr_mClassDef_RtReadOnly", pwr_mClassDef_RtReadOnly }
,{ 0, 0 }
};
......
/*
* Proview $Id: wb_wccm.cpp,v 1.3 2007-04-25 13:39:21 claes Exp $
* Proview $Id: wb_wccm.cpp,v 1.4 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -29,7 +29,7 @@
#include "co_time.h"
#include "co_ccm.h"
#include "co_cdh.h"
#include "co_api.h"
#include "co_api_user.h"
#include "wb_utl_api.h"
#include "wb_trv.h"
#include "wb_cmd_msg.h"
......
/*
* Proview $Id: wb_wnav.cpp,v 1.40 2007-12-06 10:55:04 claes Exp $
* Proview $Id: wb_wnav.cpp,v 1.41 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -34,7 +34,7 @@
#include "wb_wnav_msg.h"
#include "wb_ldh_msg.h"
#include "wb_ldh.h"
#include "wb_login.h"
#include "co_login.h"
#include "wb_wccm.h"
#include "flow.h"
......@@ -585,13 +585,13 @@ WNav::WNav(
layout_objid(pwr_cNObjid), search_last(pwr_cNObjid), search_compiled(0),
search_type(wnav_eSearchType_No), selection_owner(0), last_selected(0),
displayed(0), scriptmode(0), dialog_width(0), dialog_height(0),
dialog_x(0), dialog_y(0), menu(0)
dialog_x(0), dialog_y(0), menu(0), admin_login(0)
{
strcpy( name, xn_name);
strcpy( user, login_prv.username);
strcpy( user, CoLogin::username());
strcpy( base_user, user);
priv = login_prv.priv;
priv = CoLogin::privilege();
base_priv = priv;
if ( window_type == wnav_eWindowType_No) {
......
/*
* Proview $Id: wb_wnav.h,v 1.15 2007-01-04 07:29:04 claes Exp $
* Proview $Id: wb_wnav.h,v 1.16 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -140,6 +140,7 @@ typedef enum {
class Ge;
class WGe;
class wb_utl;
class CoLogin;
class ApplListElem {
public:
......@@ -285,6 +286,7 @@ class WNav : public WUtility{
PalFileMenu *menu;
int init_help;
CoWow *wow;
int admin_login;
virtual void pop() {}
virtual void set_inputfocus( int focus) {}
......@@ -308,6 +310,9 @@ class WNav : public WUtility{
virtual void wge_modal_loop( WGe *wge) {}
virtual bool has_window() {return false;}
virtual wb_utl *utl_new() {return 0;}
virtual CoLogin *login_new( char *name, char *groupname,
void (* bc_success)( void *), void (* bc_cancel)( void *),
pwr_tStatus *status) { return 0;}
static int brow_cb( FlowCtx *ctx, flow_tEvent event);
static int init_brow_base_cb( FlowCtx *fctx, void *client_data);
......
/*
* Proview $Id: wb_wnav_brow.cpp,v 1.9 2007-01-04 07:29:04 claes Exp $
* Proview $Id: wb_wnav_brow.cpp,v 1.10 2008-06-24 07:52:21 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -33,7 +33,6 @@
#include "pwr_baseclasses.h"
#include "wb_wnav_msg.h"
#include "wb_ldh.h"
#include "wb_login.h"
#include "flow.h"
#include "flow_browctx.h"
#include "flow_browapi.h"
......
/*
* Proview $Id: wb_wnav_command.cpp,v 1.51 2008-05-29 14:56:46 claes Exp $
* Proview $Id: wb_wnav_command.cpp,v 1.52 2008-06-24 07:52:22 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -38,10 +38,11 @@
#include "pwr_baseclasses.h"
#include "co_ccm_msg.h"
#include "co_regex.h"
#include "co_user.h"
#include "rt_load.h"
#include "wb_ldh.h"
#include "wb_ldhload.h"
#include "wb_login.h"
#include "co_login.h"
#include "wb_utl_api.h"
#include "wb_genstruct.h"
#include "wb_lfu.h"
......@@ -62,7 +63,7 @@
#include "wb_wge.h"
#include "co_xhelp.h"
#include "wb_wccm.h"
#include "co_api.h"
#include "co_api_user.h"
#include "wb_env.h"
#include "wb_erep.h"
#include "wb_vrepwbl.h"
......@@ -801,6 +802,26 @@ static int wnav_noedit_func( void *client_data,
return WNAV__SUCCESS;
}
static void wnav_login_success_bc( void *ctx)
{
WNav *wnav = (WNav *)ctx;
char msg[80];
CoLogin::get_login_info( 0, 0, wnav->user, (unsigned long *)&wnav->priv, 0);
if ( wnav->admin_login) {
wnav->admin_login = 0;
wnav->priv = pwr_mPrv_Administrator;
CoLogin::insert_login_info( "", "", wnav->user, wnav->priv, 0);
}
sprintf( msg, "User %s logged in", wnav->user);
wnav->message('I', msg);
}
static void wnav_login_cancel_bc(void *wnav)
{
((WNav *)wnav)->admin_login = 0;
}
static int wnav_login_func( void *client_data,
void *client_flag)
{
......@@ -822,16 +843,17 @@ static int wnav_login_func( void *client_data,
// Username and password are not required
strcpy( wnav->user, "Administrator");
wnav->priv = pwr_mPrv_Administrator;
strcpy( login_prv.username, "Administrator");
login_prv.priv = (pwr_mPrv) wnav->priv;
CoLogin::insert_login_info( "", "", "Administrator", wnav->priv, 0);
wnav->message('I', "Administrator logged in");
return WNAV__SUCCESS;
}
else {
// Check user and password in systemgroup "aministrator"
if ( EVEN( dcli_get_qualifier( "dcli_arg1", arg1_str, sizeof(arg1_str)))) {
wnav->message('E',"Username and password required");
return WNAV__SYNTAX;
wnav->admin_login = 1;
wnav->login_new( "PwR Login", "administrator", wnav_login_success_bc,
wnav_login_cancel_bc, &sts);
return WNAV__SUCCESS;
}
if ( EVEN( dcli_get_qualifier( "dcli_arg2", arg2_str, sizeof(arg2_str)))) {
wnav->message('E',"Password required");
......@@ -839,14 +861,14 @@ static int wnav_login_func( void *client_data,
}
cdh_ToLower( arg1_str, arg1_str);
cdh_ToLower( arg2_str, arg2_str);
strcpy( arg2_str, UserList::pwcrypt(arg2_str));
sts = user_CheckUser( "administrator", arg1_str, arg2_str, &priv);
if ( EVEN(sts))
wnav->message('E',"Login failure");
else {
strcpy( wnav->user, arg1_str);
wnav->priv = pwr_mPrv_Administrator;
strcpy( login_prv.username, arg1_str);
login_prv.priv = (pwr_mPrv) wnav->priv;
CoLogin::insert_login_info( "", "", arg1_str, wnav->priv, 0);
sprintf( msg, "User %s logged in", arg1_str);
wnav->message('I', msg);
}
......@@ -854,19 +876,22 @@ static int wnav_login_func( void *client_data,
}
}
sts = utl_get_systemname( systemname, systemgroup);
if ( EVEN(sts)) return sts;
if ( EVEN( dcli_get_qualifier( "dcli_arg1", arg1_str, sizeof(arg1_str)))) {
wnav->message('E',"Syntax error");
return WNAV__SYNTAX;
wnav->login_new( "PwR Login", systemgroup, wnav_login_success_bc,
wnav_login_cancel_bc, &sts);
wnav->admin_login = 0;
return WNAV__SUCCESS;
}
if ( EVEN( dcli_get_qualifier( "dcli_arg2", arg2_str, sizeof(arg2_str)))) {
wnav->message('E',"Syntax error");
return WNAV__SYNTAX;
}
sts = utl_get_systemname( systemname, systemgroup);
if ( EVEN(sts)) return sts;
cdh_ToLower( arg1_str, arg1_str);
cdh_ToLower( arg2_str, arg2_str);
strcpy( arg2_str, UserList::pwcrypt(arg2_str));
sts = user_CheckUser( systemgroup, arg1_str, arg2_str, &priv);
if ( EVEN(sts))
wnav->message('E',"Login failure");
......@@ -874,8 +899,7 @@ static int wnav_login_func( void *client_data,
{
strcpy( wnav->user, arg1_str);
wnav->priv = priv;
strcpy( login_prv.username, arg1_str);
login_prv.priv = (pwr_mPrv) priv;
CoLogin::insert_login_info( "", "", arg1_str, wnav->priv, 0);
sprintf( msg, "User %s logged in", arg1_str);
wnav->message('I', msg);
}
......@@ -900,8 +924,7 @@ static int wnav_logout_func( void *client_data,
}
strcpy( wnav->user, wnav->base_user);
wnav->priv = wnav->base_priv;
strcpy( login_prv.username, wnav->base_user);
login_prv.priv = (pwr_mPrv) wnav->priv;
CoLogin::insert_login_info( "", "", wnav->base_user, wnav->priv, 0);
return WNAV__SUCCESS;
}
......@@ -1717,8 +1740,8 @@ static int wnav_show_func( void *client_data,
}
else
{
user_DevPrivToString( login_prv.priv, priv_str, sizeof(priv_str));
sprintf( msg, "User %s (%s)", login_prv.username, priv_str);
user_DevPrivToString( CoLogin::privilege(), priv_str, sizeof(priv_str));
sprintf( msg, "User %s (%s)", CoLogin::username(), priv_str);
wnav->message('I', msg);
}
}
......
/*
* Proview $Id: wb_wtt.cpp,v 1.38 2008-04-07 14:53:06 claes Exp $
* Proview $Id: wb_wtt.cpp,v 1.39 2008-06-24 07:52:22 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -32,7 +32,7 @@
#include "co_wow.h"
#include "wb_utl_api.h"
#include "wb_lfu.h"
#include "wb_login.h"
#include "co_login.h"
#include "rt_load.h"
#include "wb_foe_msg.h"
#include "wb_pwrb_msg.h"
......@@ -739,14 +739,14 @@ int Wtt::set_edit()
case ldh_cGlobalVolumeListVolume:
case ldh_cUserDatabaseVolume:
// Privilege Administrator required
if ( !(login_prv.priv & pwr_mPrv_Administrator)) {
if ( !(CoLogin::privilege() & pwr_mPrv_Administrator)) {
message( 'E', "User is not authorized to administrate");
return 1;
}
break;
default:
// Privilege DevConfig required
if ( !(login_prv.priv & pwr_mPrv_DevConfig)) {
if ( !(CoLogin::privilege() & pwr_mPrv_DevConfig)) {
message( 'E', "User is not authorized to configure");
return 1;
}
......@@ -1204,7 +1204,7 @@ void Wtt::activate_utilities()
utl_get_systemname( systemname, systemgroup);
sprintf( title, "PwR Utilites Volume %s, %s on %s", volname,
login_prv.username, systemname);
CoLogin::username(), systemname);
set_clock_cursor();
ute_new( title);
reset_cursor();
......@@ -1502,7 +1502,7 @@ void Wtt::activate_openclasseditor()
dcli_translate_filename( filename, "$pwr_exe/wb_open_db.sh");
sprintf( cmd,
"%s \"%s\" \"%s\" \"%s\" \"%s\" &",
filename, login_prv.username, login_prv.password, name, name);
filename, CoLogin::username(), CoLogin::ucpassword(), name, name);
set_clock_cursor();
sts = system( cmd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment