This topic is locked

(Security.getUserName()

5/9/2018 11:56:41 AM
ASPRunner.NET General questions
S
stefansuba author

Hi I am trying to show selective data based on user name. Unfortunately this statement is not working.

The part of the query.addWhere works ok but no matter who is logged in shows only to lines. The if (Security.getUserName() != "user") does not works with AD authentications.

Any ideas why ?
if (Security.getUserName() != "user")

{

query.addWhere("PART_DESCRIPTION='AtMonitor S7 Black' or PART_DESCRIPTION='Mini Monitor S7 Black'");

}
Thank you

S
stefansuba author 5/9/2018



Hi I am trying to show selective data based on user name. Unfortunately this statement is not working.

The part of the query.addWhere works ok but no matter who is logged in shows only to lines. The if (Security.getUserName() != "user") does not works with AD authentications.

Any ideas why ?
if (Security.getUserName() != "user")

{

query.addWhere("PART_DESCRIPTION='AtMonitor S7 Black' or PART_DESCRIPTION='Mini Monitor S7 Black'");

}
Thank you


By the way ,

I am using this under events "After table initialized"

Pete K 5/10/2018

Some of the security API methods don't work with AD but Security.getUserName() and Security.getDisplayName() have always worked for me. As far as I know, they should work in any server-side event.
When I hit something like this I first try to verify if the method is returning any data at all. As a test, try something like this:
MVCFunctions.EchoToOutput(Security.getUserName());