|
Your continued generosity and support of FMForums is greatly appreciated. |
faaslave
journeyman
Posts: 244

Loc: Los Angeles
Post Rank (AVG):
FMP: 8.5 Advanced OS: Mac OS X Leopard Skill: Intermediate
Tweet This Post!
|
O.K. all,
Users log into the database using their ID and password.
Once the user logs in I want to run a script.
The script is designed to take certain users to certain places, when they log in.
Can the login ID be retrieved and set into a global variable so I may direct different users to different places.
Thanks Dave
This Post: Client: 8 Advanced OS: Mac OS X Tiger
|
|
|
Ender
A Space Oddity
Posts: 4772

Loc: Minneapolis, MN
Post Rank (AVG):
FMP: 8.5 Advanced OS: Mac OS X Tiger
Tweet This Post!
|
In response to faaslave
Sure, use get(accountname).
Also, if your privilege sets are defined by something like job positions, you might find get(privilegesetname) to be useful.
|
faaslave
journeyman
Posts: 244

Loc: Los Angeles
Post Rank (AVG):
FMP: 8.5 Advanced OS: Mac OS X Leopard Skill: Intermediate
Tweet This Post!
|
In response to Ender
As a matter of fact they are.
Thanks Dave
|
faaslave
journeyman
Posts: 244

Loc: Los Angeles
Post Rank (AVG):
FMP: 8.5 Advanced OS: Mac OS X Leopard Skill: Intermediate
Tweet This Post!
|
In response to Ender
Alright, I think I still need some help.
I have priviledge sets assigned now. They look like this:
AOM
BOM
COM
DOM
EOM
FOM
AFLM
BFLM
CFLM
DFLM
EFLM
FFLM
When an Operational manager logs in that belongs to Area B, their priviledge set is BOM
When a Front Line Manager logs in that belongs to Area C, their priviledge set is CFLM
So the purpose of the login script is to take the user to the OM layout or FLM layout when they log in, and set the pk_area_id to the correct letter, then find only records for their area.
An FLM from Area F, logs in with priviledge set FFLM, then is taken to the FLM layout, sets the area id to F, performs a find and shows all of the area F FLM records.
As far as I can figure out, the priviledge set returns something like this [FFLM]
So I set the global variable $$master to get (priviledgesetname)
So to tell FM which layout to go to I need to do something like, use the left function to grab the 3rd character from the left, "F" and take me to the FLM layout. Then use the left function again to grab the second character "F", set the pk_area_id to "F" and perform a find to show all of F's records.
I just can't figure out how to write the script correctly.
Any help would be appreciated.
Thanks Dave
|
Ender
A Space Oddity
Posts: 4772

Loc: Minneapolis, MN
Post Rank (AVG):
FMP: 8.5 Advanced OS: Mac OS X Tiger
Tweet This Post!
|
In response to faaslave
Sorry, I can't think in terms of acronyms.
Anyway, I only see two different user classes in there: Front-Line Managers and Operational Managers. Within those classes, the privileges would probably be the same. If you are interested in this type of very specific privilege sets, it can be done more easily by using Extended Privileges (you can look up Steven Blackwell's white papers on this for more details).
I think a better way to handle your situation is to use just the two privilege sets (Operational Managers and Front Line Managers) and a User table that has a field for their Area, and reference that information from a relationship between an unstored calc= get(AccountName) and the User::AccountName field. This allows for greater flexibility in the details that might be needed about the current user, including their Name, Position, Phone Number, Email Address, etc., etc.
For isolating the records for their Area, you can use a Go to Related Records [ Show ] step, like this:
If [ not isempty(Invoice by Area::Invoice#) ]
Go to Related Records [ Show only related records; Invoice by Area ]
If [ get(privilegesetname) = "Operational Managers" ]
Go to Layout [ OM Entry (Invoice) ]
Else If [ get(privilegesetname) = "Front Line Managers" ]
Go to Layout [ FLM Entry (Invoice) ]
Else
#Anybody else
Go to Layout [ Default Layout (Invoice) ]
End If
Else
#No records for this Area
Go to Layout [ Default Layout (Invoice) ]
End If
where 'Invoice by Area' is a relationship between User and Invoice (or whatever table) by the AreaID.
|
faaslave
journeyman
Posts: 244

Loc: Los Angeles
Post Rank (AVG):
FMP: 8.5 Advanced OS: Mac OS X Leopard Skill: Intermediate
Tweet This Post!
|
In response to Ender
I guess it would make more sense to attach a file.
When the user logs in, their user name does not match any record.
So I figured the only way was to set some globals.
If they logged in, using the priviledge set AOM.
wouldn't something like Middle (Get (PriviledgeSetName) ;2;1) work to grab A. Then I could use the A to sort for all of A's records.
Likewise Middle (Get (PriviledgeSetName) ;3;1) would grab the O, and I could use this to take me to the OM layout?
by the way, the middle function as stated above didn't work, I think I am using it wrong
Here is the file, maybe it will make more sense
Thanks Dave
|
|
Your continued generosity and support of FMForums is greatly appreciated. |
faaslave
journeyman
Posts: 244

Loc: Los Angeles
Post Rank (AVG):
FMP: 8.5 Advanced OS: Mac OS X Leopard Skill: Intermediate
Tweet This Post!
|
In response to faaslave
I think I ended up doing something similar to what you are saying. Well it works anyway.
Thanks for your help,
Dave
|
|
|