Job Queue Permission Issue in NAV5.0

Hi all,

Today I’m fighting with NAV and NAS about the job queue in our test enivorenment,what happened to me is the log shown that I’m not be setup to run the object ID. I’m a DBA and have myself been setup as SUPER,

Super(data), super(NAVPAN) in NAV. So What’s the story? I can run the object manunally.

Hi Nyjjack,

There are 2 things you should look at.

  1. The object are executed with the permission of the user who created the jobqueue-entry, not the user who starts the jobqueue.
  2. In 5.0 the “Job Queue Start Codeunit” (ID = 449) had a bug in the function to check permissions.
    This has been corrected in 5.0SP1.
    The bug caused the permission of the next user in the list to be the permissions checked, not the permissions of the userid from the Job Queue Entry card.

I’ve managed to find some code i did at a client, to correct this issue:

CU449:
HasWinPermission(UserId2 : Text[65];ObjectType : Integer;ObjectID : Integer) : Boolean

IF WinLogin.FINDSET THEN
REPEAT
WinLogin.CALCFIELDS(ID);
// >> ARP1
CopyFromPos := STRLEN(WinLogin.ID) - STRLEN(UserId2);
IF CopyFromPos <= 0 THEN
CopyFromPos := 1;
Found := UPPERCASE(COPYSTR(WinLogin.ID,CopyFromPos)) = UPPERCASE(STRSUBSTNO(’%1’,UserId2));
//Found := UPPERCASE(COPYSTR(WinLogin.ID,STRLEN(WinLogin.ID) - STRLEN(UserId2))) = UPPERCASE(STRSUBSTNO(’%1’,UserId2));
// << ARP1
// >> ARP2
IF Found THEN
WinLogin2.GET(WinLogin.SID);
// << ARP2
UNTIL Found OR (WinLogin.NEXT = 0);
IF NOT Found THEN
EXIT(FALSE);

// >> ARP2
//HasPermission := WinAccessControl.GET(WinLogin.SID,‘SUPER’,COMPANYNAME);
HasPermission := WinAccessControl.GET(WinLogin2.SID,‘SUPER’,COMPANYNAME);
// << ARP2
IF NOT HasPermission THEN
// >> ARP2
//HasPermission := WinAccessControl.GET(WinLogin.SID,‘SUPER’,’’);
HasPermission := WinAccessControl.GET(WinLogin2.SID,‘SUPER’,’’);
// << ARP2
IF HasPermission THEN
EXIT(TRUE);

Permission.SETRANGE(“Object Type”,ObjectType);
Permission.SETRANGE(“Object ID”,ObjectID);
Permission.SETRANGE(“Execute Permission”,Permission.“Execute Permission”::Yes);
IF Permission.FINDSET THEN
REPEAT
// >> ARP2
//HasPermission := WinAccessControl.GET(WinLogin.SID,Permission.“Role ID”,COMPANYNAME);
HasPermission := WinAccessControl.GET(WinLogin2.SID,Permission.“Role ID”,COMPANYNAME);
// << ARP2
IF NOT HasPermission THEN
// >> ARP2
//HasPermission := WinAccessControl.GET(WinLogin.SID,Permission.“Role ID”,’’);
HasPermission := WinAccessControl.GET(WinLogin2.SID,Permission.“Role ID”,’’);
// << ARP2
UNTIL HasPermission OR (Permission.NEXT = 0);
EXIT(HasPermission);

(Note that the code i’ve documented with ARP1 corrects another issue, that a “The value of COPYSTR parameter 1 is outside the permitted range…” could come up, if the usernames have different lengths.
ARP2 corrects the current issue)

Thanks for the quick reply, the problem is we don’t have the lisence to view the code, not even for modification. we already pay Eclipse(our 3rd party) to config the NAS and do moification for us. Looks like they haven’t notice this bug yet.

Look’s like I still need some help about this issue. Today,I receive the fix from Eclipse. I guess,what they did is export the codeunit 449 from NAV5.0Sp1. And deliver the soluation, what they told me is import the fob, complie it. But during the compling ther message shown “Reference to the member ShortUserID of the variable could not be solved.” I don’t think they tested before they give me the fob. And I don’t think a simple export from SP1 and import to NAV5.0 will handle this issue.

Can anyone helpme?

Hi Nyjjack,

This error is referring to a function added into the “Login Management” codeunit 418 - it’s a function to strip out the “Domain” part out of a windows login. This is the fix that Alexander has coded above. I don’t have both version on this PC so If you get this codeunit you shuld be ok.

Let us know how you get on.

Hi, DaveT

Thank you for quick reply, looks like they worked that out. One more thing I have trouble is I want a report in the job queue and recurrer every night, that report need some filter to fillin, is there any possible when I create job I can specify the parameters in parameter string and run the job without touch the code, I was informed report need to be modified to achieve that. If it do need to be modified, can anybody tell me it is a standard issue.

The other question about the job queue is, can I specified a period of time, if the job still running after this period of time, the job must be stoped. Is there any possible to achieve that?

Thank you for those who can help

Hi Nyjjack,

The job queue is running through NAS so no user interface is allowed. This is normally acheived by creating a custom parameter table and the report reading from the table.

Again this would require coding in the Job Queue Dispatcher codeunit but you would need to think this through - how to restart / error report etc.

Hi Nyjjack,

I think your last questions belong to a new thread.

It’s correct that a little modification is needed to make the Parameter String come into play.

However the way to do that, is to create a new codeunit that is put in front of the report (you create your Job Queue Entry to run the codeunit, wich then runs the report.)
When a report is run from the Job Queue it doesn’t send the parameter to the report first.
When a codeunit is run from the Job Queue, it gets the Job Queue Entry as a parameter, and thereby you will be able to handle any Parameters in the OnRun-trigger of the codeunit, before the report is called.

There are also no standard functionality (to my knowledge) to handle stopping the job after a given time-period, but that can be handled in the codeunit too (now the codeunit begins to be a bit more complex)

Damn it Dave. You’re too fast [:D]

It’s just like Buses - none for 5 hours and then 2 come at once [:D]

I am facing a problem in nav 2009 please any one have solution

Error

Reference to the member findTDSSetup of the variable could not be solved.

What are you trying to do and when are you getting error?

Sir when we try a simple entry post as expense and credit to vendor after deduction of tds contractor this error is shown

Can you activate the debugger and check where exactly you are getting error message?

have you done any customization?

If yes, please contact your partner