Function addUserPVSS() destroy user "root*

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
6 posts • Page 1 of 1
marcel.gay@wimag.ch
Posts:62
Joined: Thu May 07, 2015 6:55 pm

Function addUserPVSS() destroy user "root*

Post by marcel.gay@wimag.ch »

If use addUserPVSS the account "root" is modified
- Password is changed
- group is empty

Remarques
- goup and password can Resset if gedi was open during this function or restart project with an other user with root access)
- I don't use OS-ID Kerberos authentification, the panel that performs this function is only active on the server where the project is installed and has root access

dyn_string ds_UserName;
string sNewUser;
sNewUser = "TestUser1111";
// get username
dpGet("_Users.UserName", ds_UserName);
int ret = dynContains(ds_UserName, sNewUser);

if (ret > 0)
{
setValue("TEXT_USERPW", "text", "User exists (maybe disabled): " + sNewUser);
}
else
{
addUserPVSS("",sNewUser,"","");
addUserToGroupPVSS(getUserId(sNewUser) , 3);
setValue("TEXT_USERPW", "text", "Add New User: " + sNewUser);
}

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Function addUserPVSS() destroy user "root*

Post by leoknipp »

At the function addUserPVSS() you have to pass the OS user ID.
In your case you have defined an empty string instead of a valid OS user ID and this is possibly the cause why the "root" user was changed.

Best Regards
Leopold Knipp
Senior Support Specialist

marcel.gay@wimag.ch
Posts:62
Joined: Thu May 07, 2015 6:55 pm

Re: Function addUserPVSS() destroy user "root*

Post by marcel.gay@wimag.ch »

perfect, it runs

I could get the ID by

mapping m;
m = getOSUser();

and m["OSID"]

----------------------------------------------------------------

Just another question:

In the "Benutzerverwaltung" I can't delete a user, but only desavtivate or activate (possible to change by CTRL _Users.Enabled), e.g. removeUserFromGroupPVSS()

Through tests I have created some "TestUser <nnnn>" and I would like to permanently delete them from the _Users database. is this possible ?

kilianvp
Posts:443
Joined: Fri Jan 16, 2015 10:29 am

Re: Function addUserPVSS() destroy user "root*

Post by kilianvp »

its not recommend but you can delete the entries in the arrays and and write the arrays back.

be sure the user isn't member of any groups!

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Function addUserPVSS() destroy user "root*

Post by leoknipp »

In WinCC OA the user ID is saved when a value is stored in the archive or when an alert is acknowledged.
If the _Users datapoint is modified and entries are deleted the same ID is possibly used again for a different user created afterwards.
When reading historical data you will then find entries which do not belong to a specific user which might cause confusion.

In version 3.17 a user can be "deleted".
The information is then deleted from the _Users datapoint and transferred to _Deleted_Users.
This solution was implemented to prevent the duplicate usage of the same user ID.

Best Regards
Leopold Knipp
Senior Support Specialist

marcel.gay@wimag.ch
Posts:62
Joined: Thu May 07, 2015 6:55 pm

Re: Function addUserPVSS() destroy user "root*

Post by marcel.gay@wimag.ch »

There is a mistake in the docu and I would like to add some information

-----------------------------

Synopsis
int addUserPVSS(string osID, string userName, langString userFullName = "", langString userComment="");

in Help:
addUserPVSS() Rückgabewert Bei Erfolg 0, bei Fehler -1.
Correct is:
Rückgabewert Bei Erfolg "UserID -> c0......", bei Fehler -1 is correct

-----------------------------

I had the problem that with a new addUserPVSS (string not a new one but the last user overwritten again and again, activated if not active and the group was removed
The OS ID is a kind of key that is used and is assigned to each user differently
I always generated the OD from the user root and was therefore always the same as what did not work
Since I do not need the OSID but each user must have a different value (otherwise PCSS New USer does not work), I have created a unique value with the date and time. Otherwise I don't use it and this is not a problem for my application.


Finally, our in-house developed SSO is ready and functional

6 posts • Page 1 of 1