Commit 203ff8a3 authored by Claes Sjofors's avatar Claes Sjofors

Xtt oplog, category user added for login and logout

parent ce319ad9
......@@ -165,6 +165,9 @@ void XttLog::category_to_string( xttlog_eCategory category, char *str)
case xttlog_eCategory_GeConfirmCancel:
strcpy( str, "GeConfirmCancel");
break;
case xttlog_eCategory_User:
strcpy( str, "User");
break;
default:
strcpy( str, "");
}
......@@ -192,6 +195,8 @@ void XttLog::string_to_category( char *str, xttlog_eCategory *category)
*category = xttlog_eCategory_GeConfirmOk;
else if ( strcmp( str, "GeConfirmCancel") == 0)
*category = xttlog_eCategory_GeConfirmCancel;
else if ( strcmp( str, "User") == 0)
*category = xttlog_eCategory_User;
else
*category = xttlog_eCategory_;
}
......
......@@ -54,6 +54,7 @@ typedef enum {
xttlog_eCategory_Event,
xttlog_eCategory_GeConfirmOk,
xttlog_eCategory_GeConfirmCancel,
xttlog_eCategory_User,
xttlog_eCategory__
} xttlog_eCategory;
......
......@@ -3721,7 +3721,8 @@ int XNav::init_brow_base_cb( FlowCtx *fctx, void *client_data)
XNav *xnav = (XNav *) client_data;
BrowCtx *ctx = (BrowCtx *)fctx;
BrowCtx *secondary_ctx;
int sts;
int sts;
char msg[120];
if ( Lng::translatefile_coding() == lng_eCoding_UTF_8)
brow_SetTextCoding( ctx, flow_eTextCoding_UTF_8);
......@@ -3788,6 +3789,9 @@ int XNav::init_brow_base_cb( FlowCtx *fctx, void *client_data)
xnav->command( cmd);
}
sprintf( msg, "User %s logged in", xnav->user);
XttLog::dlog( xttlog_eCategory_User, msg, 0, 0);
// Execute the setup script
xnav->gbl.setupscript_exec( xnav);
......@@ -3846,6 +3850,7 @@ int XNav::login()
char systemgroup[80];
pwr_sSecurity sec;
char username[80];
char msg[120];
priv = base_priv = 0;
......@@ -3865,9 +3870,13 @@ int XNav::login()
strcpy( user, username);
strcpy( base_user, username);
priv = base_priv = privilege;
sprintf( msg, "User %s logged in", username);
XttLog::dlog( xttlog_eCategory_User, msg, 0, 0);
return XNAV__SUCCESS;
}
priv = base_priv = sec.DefaultXttPriv;
XttLog::dlog( xttlog_eCategory_User, "No user logged in", 0, 0);
return XNAV__SUCCESS;
}
......
......@@ -629,10 +629,11 @@ static int xnav_define_func( void *client_data,
static void xnav_login_success_bc( void *ctx)
{
XNav *xnav = (XNav *)ctx;
char msg[80];
char msg[120];
CoLogin::get_login_info( 0, 0, xnav->user, (unsigned long *)&xnav->priv, 0);
sprintf( msg, "User %s logged in", xnav->user);
XttLog::dlog( xttlog_eCategory_User, msg, 0, 0);
xnav->cologin = 0;
xnav->message('I', msg);
if ( xnav->op)
......@@ -653,7 +654,7 @@ static int xnav_login_func( void *client_data,
char arg2_str[80];
char systemgroup[80];
unsigned int priv;
char msg[80];
char msg[120];
sts = gdh_GetObjectInfo ( "pwrNode-System.SystemGroup", &systemgroup,
sizeof(systemgroup));
......@@ -682,6 +683,7 @@ static int xnav_login_func( void *client_data,
strcpy( xnav->user, arg1_str);
xnav->priv = priv;
sprintf( msg, "User %s logged in", arg1_str);
XttLog::dlog( xttlog_eCategory_User, msg, 0, 0);
xnav->message('I', msg);
if ( xnav->op)
xnav->op->set_title( xnav->user);
......@@ -693,17 +695,20 @@ static int xnav_logout_func( void *client_data,
void *client_flag)
{
XNav *xnav = (XNav *)client_data;
char msg[80];
char msg[120];
int window = ODD( dcli_get_qualifier( "/MESSAGEWINDOW", 0, 0));
if ( strcmp( xnav->base_user, "") == 0) {
sprintf( msg, "User %s logged out", xnav->user);
XttLog::dlog( xttlog_eCategory_User, msg, 0, 0);
xnav->message('I', msg);
if ( window)
xnav->wow->DisplayText( "Logout", msg);
}
else {
sprintf( msg, "User %s logged out, returned to user %s", xnav->user, xnav->base_user);
XttLog::dlog( xttlog_eCategory_User, msg, 0, 0);
sprintf( msg, "Returned to user %s", xnav->base_user);
xnav->message('I', msg);
if ( window)
......
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