Jump to content

Solved: Exception when calling GetCurrentUserID (c#)


bluvo

Recommended Posts

  • Member

Hello,

 

i have an application to check the current users presence state. But with some users i have a problem to get the current user id.

I use the following code:
 

var libManager = new SWConfigDataClientLib.LibManager(false);
libManager.BaseProtocol = SWConfigDataClientLib.SProxyObject.BaseProtocol.TCP;

libManager.AuthenticationMode = SWConfigDataClientLib.SProxyObject.AuthenticationMode.Trusted;
libManager.Username = "";
libManager.Password = "";

libManager.WSBaseUrl = "swyxsrv";

var facade = libManager.GetPhoneClientFacade();

var id = facade.GetCurrentUserID(); // <= throw the following exception

 

Access Denied: The User ... has insufficient privileges for this operation. (SSecurityAccessException)
   bei SWConfigDataWSLib.Security.SWSSecurityManager.AssertCallingPrincipalRole(IPrincipal principal, String roleName)
   bei SWConfigDataWSLib.Security.SWSSecurityManager.AssertCallingPrincipalRole(BuildInRoles role)
   bei SWConfigDataWSLib.WebServices.CPhoneClientFacadeImpl.GetCurrentUserID() (SWConfigDataSharedLib.Exceptions.SSecurityAccessException)

 

The user is member of the system administrator group in SwyxWare, so what is going wrong?

Link to comment
Share on other sites


  • Most Valued User

Hello,

 

the "AuthenticationMode" is wrong. If you want to use a username and a password for authentication you have to use the "SProxyObject.AuthenticationMode.UsernamePassword".

"SWConfigDataClientLib.SProxyObject.AuthenticationMode.Trusted" have to be used for Windows Authentication.

 

Kind regards

 

Sebastian Dreier

Link to comment
Share on other sites


  • Most Valued User

Hello,

 

oh that was a misunderstanding....
If you do not use the username/password authentication I recommend that you do not set the username and the password property but this is not the source of your problem.


Are you sure that your application is running in the correct Windows user account context?
Did you add the correct Windows account to the System Administrator group?

Furthermore if you want to use the PhoneClient facade you MUST have a SwyxWare user context. This means that you have to assign the Windows Account to a SwyxWare user (can be a dummy user without phone number) otherwise the some methods on the PhoneClient facade are not usable (throw exceptions).

 

Kind regards

 

Sebastian Dreier

Link to comment
Share on other sites


  • Member

Hello,

 

the application is running in the correct windows account, the same windows account is member of the system administrator group in SwyxWare.

There is also a swyx user with this windows account assigned.

 

Is it a problem, when this swyx user is assigned with more than one windows account?

Link to comment
Share on other sites


  • Most Valued User

Please assign the Windows account to one SwyxWare user only and give the SwyxWare user System Admin rights (just for a test).
 

By the way: What SwyxWare do you use (SwyxWare 11 or 2015 R40.3)?

Please not that the SwyxWare 2015 SDK (CDS binaries) are not compatible with SwyxWare 11. The new SDK (incl. the CDS binaries) will be released soon.

Link to comment
Share on other sites


  • Member

Hello,

 

i've already checked this points:

  • Application is running under the correct windows account
  • Authentication mode is set to Trusted
  • The windows account is assigned to a swyx user, the swyx user has only this one windows account
  • Using the current CDS SDK 2015 R40.3 assemblies
  • The windows user is in the Swyxware System Administrator group
  • The swyx user has System Administrator profile

I've run the app with different users, for some it works, for some not.

 

Supplement:

It seems to be neccessary, that the windows account is assigned to only one swyx user.

Link to comment
Share on other sites


Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.