Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!apple!jdevoto From: jdevoto@Apple.COM (Jeanne A. E. DeVoto) Newsgroups: comp.sys.mac.hypercard Subject: Re: Setting userLevel at openStack time Message-ID: <39225@apple.Apple.COM> Date: 6 Mar 90 05:46:35 GMT References: <48201@cc.utah.edu> <3048@oakhill.UUCP> Organization: Apple Computer Inc, Cupertino, CA Lines: 63 In article <3048@oakhill.UUCP> tomj@oakhill.UUCP (Tom Johnson) writes: >...although I didn't specifically state this in my original posting, the >REASON I want to put some special password protection on the stack is that >the stack will be shared by MANY people, some of whom have some familiarity >with Hypercard, but ALL of whom are engineering types that love to tinker. >Thus, to make sure that this business-oriented stack continiues to perform its >purpose, it is necessary to add additional protection against unwanted >changing of the scripts.[...] In the interest of saving ntework bandwith, I >didn't feel it necessary to explain all of this up front. While a desire to save bandwidth is commendable, you will find that a complete statement of the problem will generally net more helpful and varied answers. In this case, it seems that you do not object to users looking at the scripts, nor do you particularly want to override their setup preferences (a particularly bad idea with HyperCard-knowledgeable users, since they often have a carefully crafted setup and will be annoyed by stacks that interfere with it). Anyway, to achieve the goal of preventing script modification, you might consider setting the cantModify property. This will lock out all changes to the stack; although users will still have script access at whatever userlevel they have set up, they won't be able to make changes to the scripts (or anything else in the stack). If you need to have users type data in to fields and such (and these changes need to be saved), you will need to use the userModify property in conjunction with the cantModify. If both these properties are true, users will be able to type into fields (assuming the userLevel is at least 2, of course...), but the changes are not permanent as long as cantModify is true. To ensure that the changes get saved, you can write a short handler like so: on saveChanges -- put data that should be saved into variables, e.g.: put field "Address" into addressVar set the cantModify of this stack to false put addressVar into field "Address" set the cantModify of this stack to true end saveChanges Your navigation handlers should call saveChanges before they go to any other card. (You may wish to put a lock screen/unlock screen pair in the saveChanges handler, since the new data disappears when cantModify is changed, resulting in mildly unpleasant flickering.) You'll also need to set the userModify global property to true in your openStack handler. This approach lets you keep scripts from being modified, without having to mess with saving and restoring the userLevel, overriding user preferences, or risking messing up someone else's stack which may depend on a custom startup handler. >Thanks for coming to the rescue, Eric, and once again, its is nice to know >that there are people out there willing to forego destructive criticism >for constructive criticism. I'm sure it is. -- ====== jeanne a. e. devoto ======================================== jdevoto@apple.com | You may not distribute this article under a jdevoto@well.UUCP | compilation copyright without my permission. ___________________________________________________________________ Apple Computer and I are not authorized | CI$: 72411,165 to speak for each other. | AppleLink: SQA.TEST