473,409 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

How to check who is logged in

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
6 3441
dima69
181 Expert 100+
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
saddist
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
181 Expert 100+
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
saddist
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
Lysander
344 Expert 100+
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
saddist
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

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

Similar topics

7
by: fr? | last post by:
Hi, i have a website , on wich users have to log in credentials are checked against mysql db some session vars are set during login for use somewhere else in the code. Is there a way to...
27
by: mrbog | last post by:
Tell me if my assertion is wrong here: The only way to prevent session hijacking is to NEVER store authentication information (such as name/password) in the session. Well, to never authenticate...
4
by: Shamrock | last post by:
Hi, I need to write application which tell me who is login. In example: 1. login as Shamrock 2. I see Shamrock login 3. someone login as Morbious 4. They both see : Shamrock & Morbious 5....
5
by: Mitul | last post by:
Hi to all, I am working on a site in which I need to check whether user is online or not. If user successfully logged out then I can change status from online to offline but if user do not...
1
by: pagates | last post by:
Hi All, This must be a simple question, but I just can't figure it out. I want to know if the user is logged in programmatically. I tried to use the LoginStatus control, but of course that...
3
by: fomalhaut | last post by:
Hi All, I am building a tool for one of our company's service desks, and one of the functions I'm hoping to add is the ability to enter a username and find what PC that user is currently logged...
4
by: Simon Gare | last post by:
Hi all, below is an insert statement on an asp page that stores the date and time that a driver logged on, what I need is to check that they are now already logged on fields are SQL Server...
1
by: SmartPHP | last post by:
Hi friends, My problem is...i want to open an application on click of some link...but before opening that application i want to check if that application is already opened with some other login id...
2
by: ascll | last post by:
Greetings, How to I know existing user already login to my website (using ASP.net 2.0, MS Web Developer's login wizard)? If the user already login, I would like to set the path for...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.