Commit c2b62bcc authored by Claes Sjofors's avatar Claes Sjofors

Xtt script functions GetUser() and GetPrivileges() added

parent 93b40620
......@@ -2804,6 +2804,8 @@ GetCurrentObject() <LINK> getcurrentobject()
pwr_get_config() <LINK> pwr_get_config()
get_node_name() <LINK> get_node_name()
get_language() <LINK> get_language()
GetUser() <LINK> getuser()
GetPrivileges() <LINK> getprivileges()
<h2>xtt-commands
xtt-commands <LINK> xtt-commands
......@@ -4022,6 +4024,8 @@ GetCurrentObject() <t>Get selected object. <LINK> getcurrentobject()
pwr_get_config() <t>Get configuration values <LINK> pwr_get_config()
get_node_name() <t>Get node name <LINK> get_node_name()
get_language() <t>Get the current language <LINK> get_language()
GetUser() <t>Get the current user. <LINK> getuser()
GetPrivileges() <t>Get the privileges for the current user. <LINK> getprivileges()
</TOPIC>
<headerlevel>
......@@ -4160,6 +4164,43 @@ string <t><t>The current langage, e.g en_us, sv_se, de_de.
<c> create opmenu/name="Functions-ProcessGraphs-Overview"/command="open graph overview"
<c> endif
</TOPIC>
<TOPIC> getuser() <style> function
GetUser()
string GetUser()
<b>Description
Get the current user.
<b>Example
<c> string user;
<c> user = GetUser();
</TOPIC>
<TOPIC> getprivileges() <style> function
GetPrivileges()
int GetPrivileges()
<b>Description
Get the privileges for the current user.
<b>Example
<c> int priv;
<c> priv = GetPrivileges();
<c> if ( priv & 4)
<c> # Has system privilege
<c> ...
<c> endif
</TOPIC>
</headerlevel>
<TOPIC> xtt-commands <style> function
......
......@@ -2577,6 +2577,8 @@ GetCurrentObject() <LINK> getcurrentobject()
pwr_get_config() <LINK> pwr_get_config()
get_node_name() <LINK> get_node_name()
get_language() <LINK> get_language()
GetUser() <LINK> getuser()
GetPrivileges() <LINK> getprivileges()
<h2>xtt-commands
xtt-commands <LINK> xtt-commands
......@@ -3785,6 +3787,8 @@ GetCurrentObject() <t>H
pwr_get_config() <t>Hämta konfigurations-värden <LINK> pwr_get_config()
get_node_name() <t>Hämta nodnamn <LINK> get_node_name()
get_language() <t>Hämta nuvarande språk <LINK> get_language()
GetUser() <t>Hämta nuvarande användare. <LINK> getuser()
GetPrivileges() <t>Hämta privilegier för nuvarande användare. <LINK> getprivileges()
</TOPIC>
<headerlevel>
......@@ -3924,6 +3928,41 @@ string <t><t>Nuvarande spr
<c> create opmenu/name="Functions-ProcessGraphs-Overview"/command="open graph overview"
<c> endif
</TOPIC>
<TOPIC> getuser() <style> function
GetUser()
string GetUser()
<b>Beskrivning
Hämta nuvarande användare.
<b>Exempel
<c> string user;
<c> user = GetUser();
</TOPIC>
<TOPIC> getprivileges() <style> function
GetPrivileges()
int GetPrivileges()
<b>Beskrivning
Hämta privilegier för nuvarande användare.
<b>Exempel
<c> int priv;
<c> priv = GetPrivileges();
<c> if ( priv & 4)
<c> # Has system privilege
<c> ...
<c> endif
</TOPIC>
</headerlevel>
<TOPIC> xtt-commands <style> function
......
......@@ -8290,6 +8290,50 @@ static int xnav_setattribute_func(
return 1;
}
static int xnav_getuser_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
XNav *xnav;
if ( arg_count != 0)
return CCM__ARGMISM;
xnav_get_stored_xnav( &xnav);
strcpy( return_string, xnav->user);
*return_decl = CCM_DECL_STRING;
return 1;
}
static int xnav_getprivileges_func(
void *filectx,
ccm_sArg *arg_list,
int arg_count,
int *return_decl,
ccm_tFloat *return_float,
ccm_tInt *return_int,
char *return_string)
{
XNav *xnav;
if ( arg_count != 0)
return CCM__ARGMISM;
xnav_get_stored_xnav( &xnav);
*return_int = xnav->priv;
*return_decl = CCM_DECL_INT;
return 1;
}
static int xnav_ccm_deffilename_func( char *outfile, char *infile, void *client_data)
{
pwr_tFileName fname;
......@@ -8369,6 +8413,10 @@ int XNav::readcmdfile( char *incommand, char *buffer)
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "ConfirmDialog", xnav_confirmdialog_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "GetUser", xnav_getuser_func);
if ( EVEN(sts)) return sts;
sts = ccm_register_function( "GetPrivileges", xnav_getprivileges_func);
if ( EVEN(sts)) return sts;
sts = ccm_create_external_var( "GLOW__SUBTERMINATED", CCM_DECL_INT, 0, GLOW__SUBTERMINATED, 0);
......
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