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