Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Contributor
jryals
Posts: 37
Registered: 11-23-2008
0

Temporarily users rights.

I need to temporarily set a Users rights to an Administrative role in a VB script.  Any input would be appreciated. Thanks.

Sage MAS Partner
accountingnerd
Posts: 64
Registered: 10-22-2010
0

Re: Temporarily users rights.

Are you talking about MAS rights or rights on the PC? If you're talking about MAS, then it's probably better/easier to create a dummy account that can do whatever you need it to do. If you are talking about the PC, then you need to look at the "runas" command, which allows you to run a program as an administrator with full admin rights. You can elevate an individual users rights, but that user would have to log out and log back in for those rights to take effect, which is probably not practical in a script.

 

Hope that helps.

 

Aaron J. Clark, CPA, CITP
SGS Technology Group
Our Blog
If you don't like change, you're going to like irrelevance even less.
Contributor
jryals
Posts: 37
Registered: 11-23-2008
0

Re: Temporarily users rights.

Here is my problem.  I've created a vb script to edit the GL number on the sales order lines which is a combination of the customer division, warehouse, and a UDF order type.  It is triggered after the item number is entered.  It works fine if you have the rights to General Ledger Maintance.  It gives an error 88 without the rights.  Can't let sales people have these rights.

 

I tried using the code from SY_Security but I can't seem to make it work:

 

' create security object for security event checking

coSecurity = NEW("SY_Security", coSession, taskID, 1)

 

' pass in the user/password to validate and check rights

rights=coSecurity'CheckOverrideOptPassword(Administrator, "password")

 

 

Moderator
Natasha
Posts: 180
Registered: 07-15-2009
0

Re: Temporarily users rights.

[ Edited ]

In my test, I (my role) don't have any rights to G/L Account Maintenance.   I have G/L Module Option 'Allow Automatic Creation of Accounts' checked.  G/L setup option 'Auto Create when all Segments are Valid' is Yes.

 

In my SO_SalesOrderDetail, ItemCode PostValidate script, I set SalesAcctKey$ to a not-on-file account number.  All segments in this account are valid.  It creates this G/L account.

 

retVal = 0

retVal = oBusObj.SetValue("SalesAcctKey$", "111-60-04", "kACCOUNT")

 

(I assume that you want to make new G/L account.)

Natasha Chang
Sr. Software Engineer
Sage 100 ERP