Jump to content
Sign in to follow this  
innodes

script navigation question

Recommended Posts

I am using a script navigation system based on one from JMO. It is working great! It uses the table name plus a portion of the layout name in combination of a strick layout naming convention to navigate.

ie, Get (LayoutTableName) & "_list" in the Sample table navigates to the Sample_list layout.

The system has really helped simplify my db. I have introduced various validation scripts and previledge checks. There is one that works when written specifically to the layout, but doesn't when trying to call that layout table name in order to "build" the correct layout name. I'm pretty sure my syntax is off.

This portion of the script is to allow only the original author of the data into an edit layout:

This works as a direct call:

The table is Data, the field is data_user_id

If [Get (UserName) = Data::data_user_id]

Perform Script ["Go To Edit"]

I think what I need is something like this, but the Specify Calculation won't let me enter it:

Get ( UserName ) = Get ( LayoutTableName ) :): Get ( LayoutTableName) & "_user_id"

How do I do this?

thanks,

idee

Edited by Guest

Share this post


Link to post
Share on other sites

You'd need to write that:

Get ( UserName ) = Get ( LayoutTableName ) & "::" & Get ( LayoutTableName) & "_user_id"

Share this post


Link to post
Share on other sites

THANK YOU !!!

I was messing with this for quite a while, but missed the simple thing. Thanks again!

Share this post


Link to post
Share on other sites

OK, it was working, but for whatever reason, now is not. Please see the attached screen shot. It is the script with a Data Viewer window on top of it. The script jumps from the IF to the ELSE as if the data did not match, but if you look at the Data Viewer, it seems like there is a clean match.

any help is greatly appreciated,

thanks,

script-verify_author.jpg

Share this post


Link to post
Share on other sites

The text string "mbigg1" does NOT equal the text string "KNUMBERS::KNUMBERS_user_id". You need to use the GetField() or Evaluate() function to convert a string to a field reference.

BTW, I am not sure what you're doing, but it doesn't seem like a good system to handle user's privileges:

http://fmforums.com/forum/showtopic.php?tid/180727/

Share this post


Link to post
Share on other sites

Thanks,

I used Evaluate, and it worked.

Get ( UserName ) = Evaluate ( Get ( LayoutTableName ) & "::" & Get ( LayoutTableName ) & "_user_id" )

I am not checking against privileges or setting anything. All this script is intended to do is to verify if this is the user that created this original record. If so, they get access to edit limited information, if not they are turned away. Is that dangerous? I have printed the link on the vulnerability and will be reading it.

If you have any additional feedback, I am open to listen and learn.

thanks again for the help and comments.

Share this post


Link to post
Share on other sites

I believe it's much better to do this in Account & Privileges, even if it means setting it up for each table. This way it will not depend on layout naming or script running - instead, it will be protecting the data directly at data level.

In your example, I could probably create a new file, define a relationship to your file, put your fields on MY layout and edit away in any record.

You'd probably be better off using account name instead of user name too.

Share this post


Link to post
Share on other sites

It does use the AccountName with a priviledge set for access to this part of the database. This user will already be within a secured area. This just narrows it a bit more to author per record.

thanks again

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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