Jump to content

The simplest things...


This topic is 8270 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have put together a script that will check the user to see if he/she has the appropriate permission to a particular layout. The script is great with the one exception that IT DOES NOT WORK.

Am I on the right track...?

If["PatternCount(Status(CurrentUser), "Joe")"]

Show Message ["You do not have the appropriate permissions to access this layout."]

Else

Go to Layout [secret Layout]

End If

Why does it not work?

Link to comment
Share on other sites

It kind of depends on what you intended the script to do. What this one does is looks for the name "Joe" in the current user name and if it is found doesn't allow access. Did you intend to allow "Joe" access? If so you either need to put a "not" in front of the If statement condition or switch the Show Message and Go to Layout steps.

-bd

Link to comment
Share on other sites

OK, I must be confused. I modified my original script to this...

If["Status(CurrentUserName) = "mtnbiker""]

Go to Layout ["Test Layout"]

Else

If[isEmpty(Status(CurrentUserName))"]

Show Message ["You must have a user name for access."]

End If

End If

I have used the password 'mtnbiker" to get into my database. What exactly is user name in 'CurrentUserName'? Is it the password or is the actual user name used to log onto my local network? What am I doing wrong? The above script just keeps giving me my message that I do not have a user name. Ideally, I would like to use the password to allow/disallow users access to certain layouts.

HELP!

Link to comment
Share on other sites

If you look under “Edit/Preferences/Application” in FM you’ll see the user name – this is the value used by FM in the status option. It is usually the name of the computer that the logged in guest is using, unless he/she has changed it. The user name in FM has nothing to do with the password.

So, in this case if you want to use a script which can only do certain things if a particular user is using it (lets say the user is Rigsby) then you need to shut all other users out of the script. So to do this you were on the right lines with your “IF” statement, but you need to use a “NOT” as liveOak said, or I would simply use the “something other than” option, i.e.:

If [status(CurrentUserName) <> "Rigsby"]

Then you can tell the script to do what you want. E.g. Show message:

“You don’t have the necessary rights to access this layout”

etc., etc., etc.

The bad news here is if someone else is on your work station.

On the other hand, you can use the access privileges (under the menu "File") in FM to decide who can do what in your files. The FM help-files or handbook describes this pretty well. If you don’t have any experience with the FM access privileges, make a backup of your files before you start to experiment.

Hope this helps,

Rigsby

Link to comment
Share on other sites

Thanks Rigsby. That clarifies a lot. I think I will go with PatternCount(Status(CurrentGroups) instead.

This seems to work just as well. Thanks for the input.

I am aware of the locking out layouts in the access area. However, it is seriously inconveinent to the user when she/he receives an 'access is denied' screen and cannot do anything but close the program.

Once again, thanks for the input. Greatly appreciated!

Link to comment
Share on other sites

This topic is 8270 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.