By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,347 Members | 2,113 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,347 IT Pros & Developers. It's quick & easy.

How to check who is logged in

P: 40
Hello,

For certain reasons I had to make my own USERS table where I store username, passwd, access_lvl and so on. Now I would like to display certian data from database depending on what access_lvl logged user have. I can't think of any method how to check who is logged in:/ I thought about adding new field IS_LOGGED and update it anytime some1 loggs. But then again how will I set it false when someone will just close access?
I'd be glad for some ideas

P.S. Maybe there is some way to set access_lvl without my own USERS table I just don't know about
Aug 2 '07 #1
Share this Question
Share on Google+
6 Replies


dima69
Expert 100+
P: 181
Hello,

For certain reasons I had to make my own USERS table where I store username, passwd, access_lvl and so on. Now I would like to display certian data from database depending on what access_lvl logged user have. I can't think of any method how to check who is logged in:/ I thought about adding new field IS_LOGGED and update it anytime some1 loggs. But then again how will I set it false when someone will just close access?
I'd be glad for some ideas

P.S. Maybe there is some way to set access_lvl without my own USERS table I just don't know about
You can implement this using record locking, i.e. making each user lock his record in the table on login. Then closing Access will release the lock. You will be able to diplay "Who is logged" by checking wich record is locked.

P.S. That's just the general idea, real implementation can be quite complicated :)
Aug 2 '07 #2

P: 40
You can implement this using record locking, i.e. making each user lock his record in the table on login. Then closing Access will release the lock. You will be able to diplay "Who is logged" by checking wich record is locked.

P.S. That's just the general idea, real implementation can be quite complicated :)
That would be fine if there weren't any shared records. Some records can be viewed by more then one access_lvl. Also it will lock record for another user with same access_lvl
Aug 2 '07 #3

dima69
Expert 100+
P: 181
That would be fine if there weren't any shared records. Some records can be viewed by more then one access_lvl. Also it will lock record for another user with same access_lvl
In that case you can add records to the table as user logs in (and lock it), then deleting all unlocked records.
As I said before, it's just a general direction, implementation is up to you.
Aug 2 '07 #4

P: 40
I figured out that I will use Access build in security system, and to check who is logged I will use CurrentUser method. I will enable/disable forms/buttons ect depending on value of CurrentUser. It will be troublesome becouse I will have like 150 users, who can view a values in table depending on thier login. F.E. if manager1 is logged in I want to view only employees that are subordinates of manager1, same for manager2 etc. Is there some better way to do that than writing 150 IF's ? :)
Aug 3 '07 #5

Expert 100+
P: 344
I figured out that I will use Access build in security system, and to check who is logged I will use CurrentUser method. I will enable/disable forms/buttons ect depending on value of CurrentUser. It will be troublesome becouse I will have like 150 users, who can view a values in table depending on thier login. F.E. if manager1 is logged in I want to view only employees that are subordinates of manager1, same for manager2 etc. Is there some better way to do that than writing 150 IF's ? :)
Create security groups and put your users into those groups (assuming there are not 150 different groups, this will be simpler). Then give those groups access to those tables you want them to see.

If you want them to see only certain rows of a table, its more tricky.

Create a superuser, i use the user 'owner' and make sure owner has full access to the table. Then, using owner, create a query, or set of queries, the select only the data you want each group to see. In the SQL for these queries, add at the end WITH OWNERACCESS OPTION
e.g.
Expand|Select|Wrap|Line Numbers
  1. SELECT LastName, FirstName, Salary FROM Employees ORDER BY LastName WITH OWNERACCESS OPTION;
  2.  
Now go into the security system and remove all access to the table from all groups, except 'owner' of course. Now give full access to the query you have just created the group that needs it.

What you now have is a situation where, say, managerLevel1 log on, and cannot access the staff table, or the data in it, but can run qryManLevel1 which runs under 'owner's permissions and lets them see the selected data.
Aug 3 '07 #6

P: 40
Create security groups and put your users into those groups (assuming there are not 150 different groups, this will be simpler). Then give those groups access to those tables you want them to see.

If you want them to see only certain rows of a table, its more tricky.

Create a superuser, i use the user 'owner' and make sure owner has full access to the table. Then, using owner, create a query, or set of queries, the select only the data you want each group to see. In the SQL for these queries, add at the end WITH OWNERACCESS OPTION
e.g.
Expand|Select|Wrap|Line Numbers
  1. SELECT LastName, FirstName, Salary FROM Employees ORDER BY LastName WITH OWNERACCESS OPTION;
  2.  
Now go into the security system and remove all access to the table from all groups, except 'owner' of course. Now give full access to the query you have just created the group that needs it.

What you now have is a situation where, say, managerLevel1 log on, and cannot access the staff table, or the data in it, but can run qryManLevel1 which runs under 'owner's permissions and lets them see the selected data.
That is really GREAT piece of advice, thank you for that :)
Unfortunalty I DO want managers to see only certain rows of a table :/ to be more specific I want manager of department to see only empolyees working in this department. And there are like 150 departments :/
Aug 3 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.