Andron
22nd April 2002, 15:41
How to limit quantity of the copies sessions with the same name, started by the same user (For example no more one session with name Sess1 started by users U1, U2 ... UN)

mark_h
22nd April 2002, 17:20
Are you looking for a coding solution or an Admin type solution? If you are looking for an Admin type solution then this question might be better for the Tools Administration Forum (http://www.baanboard.com/baanboard/forumdisplay.php?s=&forumid=2) - even though a lot of admin types answer questions here.

I have not heard of a way to do this(on the admin. side), but that does not mean it is not possible.

Good Luck!

Mark

NPRao
22nd April 2002, 19:40
You can try to code in your script -

Syntax

long appl.set( string name(.), long mode )

Description

This creates an application lock for the current application.

Arguments

name The name of the application lock. This must be unique.
mode The type of application lock to set:APPL.READ
APPL.WRITE
APPL.EXCL
APPL.WIDEYou can combine APPL.WIDE with any one of the other lock types.
Return values

0 success
-1 application-wide lock present
-3 internal error
>0 application lock already present; mode is returned

Context

3GL function library.

lbencic
22nd April 2002, 19:44
Application locks USUALLY lock the session - one copy open for all users. However, I bet if you include the user name in the application name when you create the lock, you can use it for this purpose.

NPRao
22nd April 2002, 20:05
you are right Lisa.

It can be handled by coding depending on the logic/requirement in this situation like -

if not appl.get.user( string name(.), ref string user(12) ) and logname$ <> user and not appl.set("00112334455", APPL.WRITE + APPL.WIDE) then
**...** [do something]-or give message you are not authorized to execute this session or application lock already set...
endif


Examples
This example sets a write-type application lock for all companies. Only the owner can modify the application's data in all companies.

appl.set("00112334455", APPL.WRITE + APPL.WIDE)
This example sets an exclusive-type application lock on a production order and subsequently deletes it.

if appl.set( "tisfc001" & tisfc001.pdno, APPL.EXCL ) 0 then
| Lock is already present, give message
return
endif
. . . .
appl.delete( "tisfc001" & tisfc001.pdno )


Syntax

long appl.get.user( string name(.), ref string user(12) )

Description

This retrieves the BAAN login name of the user who created the specified application lock.

Return values

0 success
-1 lock not found

Context

3GL library function.