[comp.sys.mac.programmer] Chooser User Name

resnick@lees.cogsci.uiuc.edu (Pete Resnick) (07/17/90)

How does one go about retrieving the User Name that has been typed into
Chooser or Responder? I have looked in IM II, chap 10, and IM V, chap 28,
but have found no really easy way to get this info.

pr
--
Pete Resnick             (...so what is a mojo, and why would one be rising?)
Graduate assistant - Philosophy Department, Gregory Hall, UIUC
System manager - Cognitive Science Group, Beckman Institute, UIUC
Internet/ARPAnet/EDUnet  : resnick@kant.cogsci.uiuc.edu
BITNET (if no other way) : FREE0285@UIUCVMD

minich@d.cs.okstate.edu (Robert Minich) (07/17/90)

by resnick@lees.cogsci.uiuc.edu (Pete Resnick):
| How does one go about retrieving the User Name that has been typed into
| Chooser or Responder? I have looked in IM II, chap 10, and IM V, chap 28,
| but have found no really easy way to get this info.

  If you have Think C, check out the getlogin() function defined in
":C Libraries:Sources:unixmisc.c". The pertinent info is stored in the
system file in a 'STR ' resoure with id = -16096.

-- 
| _    /| | Robert Minich             |Q: Why is the food so lousy, and 
| \'o.O'  | Oklahoma State University |the service so bad? Time traveler:
| =(___)= | minich@d.cs.okstate.edu   |A:The waiters know in advance what 
|    U    | - Bill sez "Ackphtth"     |kind of tip they'll be getting.

mxmora@unix.SRI.COM (Matt Mora) (07/18/90)

In article <1990Jul17.142154.4841@ux1.cso.uiuc.edu> resnick@lees.cogsci.uiuc.edu (Pete Resnick) writes:
>How does one go about retrieving the User Name that has been typed into
>Chooser or Responder? I have looked in IM II, chap 10, and IM V, chap 28,
>but have found no really easy way to get this info.

Glad you asked... I just wrote an INIT the resets the chooser name to the
string specified by the network admin. To get the chooser string you could
do this:

theChooserStringHandle:=GetString(-16096);

Which returns a stringhandle from the system file.

>pr
>--
>Pete Resnick             (...so what is a mojo, and why would one be rising?)








-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________

sobiloff@agnes.acc.stolaf.edu (Chrome Cboy) (07/26/90)

In article <14278@unix.SRI.COM> mxmora@unix.UUCP (Matt Mora) writes:
>In article <1990Jul17.142154.4841@ux1.cso.uiuc.edu> resnick@lees.cogsci.uiuc.edu (Pete Resnick) writes:
>>How does one go about retrieving the User Name that has been typed into
>>Chooser or Responder?[...] 
>
>Glad you asked... I just wrote an INIT the resets the chooser name to the
>string specified by the network admin.[...]

Is the INIT you wrote called "$ChooserLock"? I d/l'd it, but all it seemed to
do was prompt you for a workstation name every time the machine was booted.
Is this what was intended, or did I get a bad d/l?

I think a *lot* of admins have been looking for some way to set the Chooser
name and locking it so that it can't be changed, ever (well, without the help
of ResEdit.) I know we have. As a novice Mac programmer I wasn't sure how to
go about this until a saw a pointer from Amanda Walker and someone else over
in comp.sys.mac.misc.

The key is to set the "Protected" attribute on the resource, not the "Locked"
attribute, as was suggested. This will let the user change their Chooser name
'till their heart's content, but the change will not be saved. Thus you can
have a fairly reliable indicator of who's on the network when you only allow
Guest access to servers in public labs.

Next week I'll be working on a small program that will let a netadmin specify
a Chooser name for a startup disk, and then lock that resource. IMHO, a little
less defeatable than an INIT... :-)
							-CCb
--
"Gonna' do just what I please,
Gonna' wear no socks and shoes,
With nothing to do but feed all the kangaroos."
				-Steely Dan, "Black Friday"

mxmora@unix.SRI.COM (Matt Mora) (07/27/90)

In article <1990Jul26.144556.20663@acc.stolaf.edu> sobiloff@agnes.acc.stolaf.edu (Chrome Cboy) writes:
>In article <14278@unix.SRI.COM> mxmora@unix.UUCP (Matt Mora) writes:
>>In article <1990Jul17.142154.4841@ux1.cso.uiuc.edu> resnick@lees.cogsci.uiuc.edu (Pete Resnick) writes:
>>>How does one go about retrieving the User Name that has been typed into
>>>Chooser or Responder?[...] 
>>
>>Glad you asked... I just wrote an INIT the resets the chooser name to the
>>string specified by the network admin.[...]
>
>Is the INIT you wrote called "$ChooserLock"? I d/l'd it, but all it seemed to
>do was prompt you for a workstation name every time the machine was booted.
>Is this what was intended, or did I get a bad d/l?

No, The init I wrote is called fix chooser name. At startup it checks the
chooser name and if it is not the same as the one stored in the init,
the init changes it to match. It comes with an install program that
the netadm uses to set the name of the machine to install it on. This
init is of course very defeatable. For one you could take it out of the system
folder. Two, a user could use resedit to change the string to whatever he/she
wants it to be. Some of our people use the broadcast rdev to communicate
back to one another and sometimes change the user name in the process. This 
init at least sets it back to the correct name after each startup. The init
only does its work at startup time and does not hang around. Some people
won't find it very useful but it serves are purposes well. The majority
of our users just do their work (be it word processing or spread sheeting or
whatever) and don't have any idea (or care) of what the chooser name is used
for.

You could use resedit to install the init into the system file so that
the user can't drag it out of the trash.

>I think a *lot* of admins have been looking for some way to set the Chooser
>name and locking it so that it can't be changed, ever (well, without the help
>of ResEdit.) I know we have. As a novice Mac programmer I wasn't sure how to
>go about this until a saw a pointer from Amanda Walker and someone else over
>in comp.sys.mac.misc.

Anything you can do with resedit so can a user. So no matter what you do,
it can be defeated. You could take resedit of their machine. 

>Next week I'll be working on a small program that will let a netadmin specify
>a Chooser name for a startup disk, and then lock that resource. IMHO, a little
>less defeatable than an INIT... :-)
>							-CCb

Good luck :-)

Send me a copy when you get it done.






-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________