CHANGE CURRENT USER doesn't?

13 views
Skip to first unread message

Koen Van Hooreweghe

unread,
Mar 23, 2006, 12:14:28 PM3/23/06
to 4D-...@googlegroups.com
Hi,

I'm trying to implement my own password dialog according to the
instructions from chapter 61 of the language reference.
Unfortunately CHANGE CURRENT USER(3;"") doesn't change the user.
Though Validate password(3;"") says OK. CHANGE CURRENT USER doesn't
raise an error dialog, it just sets OK to 0. And that is all.

What could be wrong?

MacOSX, 4D 2004.3. I have set Designer as default user. Password is
blanc, user 3 is created by the Designer.

Koen

--------------------
Compass bvba
Koen Van Hooreweghe
Kloosterstraat 65
9910 Knesselare
Belgium
bvbaC...@telenet.be

Scott Wirth

unread,
Mar 23, 2006, 3:51:25 PM3/23/06
to 4D-Tech
Koen,

I believe you have to have a valid password for the user, "blank" won't
do. Don't know if 4D, Inc considers this a security issue, or if its an
oversight.

Regards,
Scott Wirth

David Baer

unread,
Mar 23, 2006, 11:42:28 PM3/23/06
to 4D-Tech
Koen

When I wrote my own password system I found that CHANGE CURRENT USER
changed the current user but only for the current process. I discovered
that one could actually have different current users for different
processes! I found that I had to store the current user in an
interprocess variable in order to achieve the functionality that made
sense to me.

David Baer
Oakland, CA

Randy Jaynes

unread,
Mar 24, 2006, 6:06:26 AM3/24/06
to 4D-...@googlegroups.com

So in order to use any 4D password related commands (like User in
Group or Current User), you have to call CHANGE CURRENT USER for
every process you start?

Is this true in both 4D 2003.7 and 4D 2004?

----------------------------------------
Randy Jaynes
Management Software

Martin Miller

unread,
Mar 24, 2006, 7:01:54 AM3/24/06
to 4D-...@googlegroups.com
Or does it honor whatever the startup process has?

On 24/03/06, Randy Jaynes <randy_...@joborder.com> wrote:
>
> So in order to use any 4D password related commands (like User in
> Group or Current User), you have to call CHANGE CURRENT USER for
> every process you start?
>
> Is this true in both 4D 2003.7 and 4D 2004?

--
Martin Miller - <http://www.AnotherSphere.net>
___________________________________________________________________
communications - infrastructure - database - 4D - MacOS

Julio Carneiro

unread,
Mar 24, 2006, 7:21:03 AM3/24/06
to 4D-...@googlegroups.com
afaik CHANGE CURRENT USER will set the new user for the current
process and any new processes.
Any existing active process will stay attached to whatever user was
current when they started, which makes sense.

Thus CHANGE CURRENT USER should only be used during startup, or if
you close all active processes. Otherwise you'll end up with a mix of
"current users" in different processes.

If you're going to rollout your own password system you have 2 options:
- do it out of 4D's password system, and loose plugin access control
- do it within 4D's password system and then you have to do the
Change Current User trick during Startup

hth
julio

Randy Jaynes

unread,
Mar 24, 2006, 8:07:54 AM3/24/06
to 4D-...@googlegroups.com
On Mar 24, 2006, at 7:21 AM, Julio Carneiro wrote:

>
> afaik CHANGE CURRENT USER will set the new user for the current
> process and any new processes.
> Any existing active process will stay attached to whatever user was
> current when they started, which makes sense.
>
> Thus CHANGE CURRENT USER should only be used during startup, or if
> you close all active processes. Otherwise you'll end up with a mix of
> "current users" in different processes.

Ahh...I think I remember a discussion about this in the last few
months. This seems to be what I remember came out of that thread.

> If you're going to rollout your own password system you have 2
> options:
> - do it out of 4D's password system, and loose plugin access control

Actually, you lose a little more than this. Like in LOCKED
ATTRIBUTES, the user parameter is the user name from the 4D password
system. If there is no password system (ie roll your own), then
"Manager" is always returned.

HTH,
Randy

Martin Miller

unread,
Mar 24, 2006, 8:35:13 AM3/24/06
to 4D-...@googlegroups.com
In which case you could shadow your own rolled users with actual 4D users.

On 24/03/06, Randy Jaynes <randy_...@joborder.com> wrote:

> Actually, you lose a little more than this. Like in LOCKED
> ATTRIBUTES, the user parameter is the user name from the 4D password
> system. If there is no password system (ie roll your own), then
> "Manager" is always returned.

--

Randy Jaynes

unread,
Mar 24, 2006, 8:45:16 AM3/24/06
to 4D-...@googlegroups.com
On Mar 24, 2006, at 8:35 AM, Martin Miller wrote:

>
> In which case you could shadow your own rolled users with actual 4D
> users.

I got that impression out of the thread, too. I just haven't had the
time to test it to be sure.

That issue with LOCKED ATTRIBUTES has been a burr in my butt for a
while, but this issue with CHANGE CURRENT USER needing to be called
at startup or when starting every process means I have to think
through how to get this accomplished in our shell without causing
problems when distributing our OEM database.

I have a method that _is_ called at the start of every process, so I
think I could do it there, but not positive until I test.

It's on the list of things to do at some point...

Koen Van Hooreweghe

unread,
Mar 24, 2006, 8:50:29 AM3/24/06
to 4D-...@googlegroups.com
OK Guys,

Thanks for all your thoughts. I got it working now.

It looks as if to get the 4D password system working, at least the
Designer must have a password. I left the Administrator password
blank and set Administrator to be the default user. So no questions
asked (by 4D) when launching the application.

I was (and am) calling CHANGE CURRENT USER from the Startup method,
so this must be OK for the new processes which will be launched later
on.

Now I can show my own user/password dialog and change the 4D user
accordingly. This is how I can get control on the 4D Plugin usage etc.

Thanks.

Koen

Op 23-mrt-06, om 18:14 heeft Koen Van Hooreweghe het volgende
geschreven:

> I'm trying to implement my own password dialog according to the
> instructions from chapter 61 of the language reference.
> Unfortunately CHANGE CURRENT USER(3;"") doesn't change the user.

--------------------

Randy Jaynes

unread,
Mar 24, 2006, 9:32:26 AM3/24/06
to 4D-...@googlegroups.com
On Mar 24, 2006, at 8:50 AM, Koen Van Hooreweghe wrote:

>
> OK Guys,
>
> Thanks for all your thoughts. I got it working now.
>
> It looks as if to get the 4D password system working, at least the
> Designer must have a password. I left the Administrator password
> blank and set Administrator to be the default user. So no questions
> asked (by 4D) when launching the application.
>
> I was (and am) calling CHANGE CURRENT USER from the Startup method,
> so this must be OK for the new processes which will be launched later
> on.
>
> Now I can show my own user/password dialog and change the 4D user
> accordingly. This is how I can get control on the 4D Plugin usage etc.

Actually, based on the comments I remember, you don't have to assign
the designer a password.

If I understand this correctly, the 4D user access system is still
active, it just doesn't give you the built-in 4D password dialog.

So you can still add/remove/change users with the 4D commands (this
is what Martin Miller meant by 'shadow your own rolled users with
actual 4D Users), and you get to give ONLY your user/password dialog.

After you exit YOUR user/password dialog, you call CHANGE CURRENT
USER, and you're at the same point you are if you had used a designer
password.

Of course, if I'm wrong about needing a designer password, you could
probably bypass 4D's built-in dialog by assigning a default user.
Then you get right up to YOUR login dialog and call CHANGE CURRENT
USER afterward.

Either way I think you're okay. But no designer password probably
makes things easier.

HTH,
Randy

Koen Van Hooreweghe

unread,
Mar 24, 2006, 10:52:16 AM3/24/06
to 4D-...@googlegroups.com
Randy,

I just tried that. Cleared the Designer password. CHANGE CURRENT USER
stops working. No error is returned, OK is set to 0 and the user is
not changed.

So, my conclusion is you really need to set a Designer password.

Koen

Op 24-mrt-06, om 15:32 heeft Randy Jaynes het volgende geschreven:

> Actually, based on the comments I remember, you don't have to assign
> the designer a password.

--------------------

Tony Ringsmuth

unread,
Jul 15, 2009, 7:09:09 PM7/15/09
to 4D Tech GoogleGroups
This is a reply to a thread from LONG AGO, but just for the record (if
anyone is scanning this old thread)...

As of 4D 2004.7, CHANGE CURRENT USER (in 4D client) will change the CURRENT
USER for ALL open processes on the 4D client.

I don't know if this has been different on any previous version of 4D 2004,
but this is what I can verify on 2004.7 (hf3).

--
Tony Ringsmuth
Business Brothers Inc.
763-420-8686
Reply all
Reply to author
Forward
0 new messages