473,385 Members | 2,069 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,385 software developers and data experts.

User log on to application

3
Hi!
I'm using access 2000 (version 9.0.270) and I have to add user login to my application.
I have a table from which rights od log on user is defined, and all rights are stored there.
Meaning, I have first table named User and second table named Job, there is many-to-many connection between them and another table named UserJob is created (this is the table mentioned in the beginig)

for example:i want my user John, who has rights to open certain form and add data, but not to delete them to be recognized trough the application based on his log in name and privilegies that he has

i have logon form but when I log on and pass this form my application doesn't recognize who is logged. How do I keep the information about logged user trough the whole application until the app is shut down?

I want to give access to certain controls only to certain users, others have to see a msg box informing them that the do not have the needed privilegies.

what i have to do to make this work?

Thanx in advance
Dec 7 '07 #1
3 1766
Dököll
2,364 Expert 2GB
....
i have logon form but when I log on and pass this form my application doesn't recognize who is logged. How do I keep the information about logged user trough the whole application until the app is shut down?

I want to give access to certain controls only to certain users, others have to see a msg box informing them that the do not have the needed privilegies.

what i have to do to make this work?

Thanx in advance
Hello there!

Hope this gets you started at least. It helps capture current user logged on. This isn't my code, previously posted expert info (good to have a library, eh!)

Expand|Select|Wrap|Line Numbers
  1.  
  2.     ' This library must be declared
  3.     Declare Function GetUserName& Lib "advapi32.dll"                          Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long)
  4.  
  5.     Function sys_OrigUserID() As String
  6.     Dim s$, cnt&, dl&
  7.     Dim max_String As Integer
  8.     Dim username As String
  9.  
  10.         max_String = 30
  11.         cnt& = 199
  12.         s$ = String$(max_String, 1)
  13.         dl& = GetUserName(s$, cnt)
  14.         username = Trim$(Left$(s$, cnt))
  15.         username = UCase(Mid(username, 1, Len(username) - 1))
  16.         sys_OrigUserID = username
  17.  
  18.     End Function
  19.  
I have yet to try this, but I think with a little tweaking you should be able to bound certain users to proper areas of your database. Perhaps an If statement can help, depending on what 'username' equals to.

Good luck, and do tell us where you are, if stuck, also post what you have working!

In a bit!
Dec 7 '07 #2
Jim Doherty
897 Expert 512MB
Hi!
I'm using access 2000 (version 9.0.270) and I have to add user login to my application.
I have a table from which rights od log on user is defined, and all rights are stored there.
Meaning, I have first table named User and second table named Job, there is many-to-many connection between them and another table named UserJob is created (this is the table mentioned in the beginig)

for example:i want my user John, who has rights to open certain form and add data, but not to delete them to be recognized trough the application based on his log in name and privilegies that he has

i have logon form but when I log on and pass this form my application doesn't recognize who is logged. How do I keep the information about logged user trough the whole application until the app is shut down?

I want to give access to certain controls only to certain users, others have to see a msg box informing them that the do not have the needed privilegies.

what i have to do to make this work?

Thanx in advance

To treat the security aspect of your application properly (or at least within the best intentions of those who created the Access security model) you should be at least looking at, or seeking to understand Access's very own security model that is to say logging into Access using a 'secure' .MDW workgroup file.

The default MDW file that Access performs under is called SYSTEM.MDW which by default is insecure. Learning 'how' to implement Access security is not the most friendly of things to get to know, but once you 'do' know you will find it caters for what you require without you having to re-invent the wheel creating your own tables of users and passwords and seeking to control SELECT permissions on 'this' table or 'edits' on that table yourself

Using Access's own security model you can define what your users CAN and CANNOT do within GROUPS that you also define all of which, including logins and passwords, are stored within a secured MDW file. Once invoked you will automatically have your ready made login box. You will have your users identified from username and password. and will be able to allow or deny the usual SELECT permissions or deny EDITS based on which group they belong to and so on.

Once logged in you can identify the user merely by calling to the inbuilt function CurrentUser() and controlling any program flow based on that.

If secured properly then another person using Access (ie: from another machine on your network) would not be able to open your database by using a standard retail 'Access' installation unless they are part of your workgroup file and for that they have to have permissions and so on. (unless they are an ardent hacker of course andI won't go into the in and outs of total access security or insecurity as can be argued) suffice it to say this 'the average user would be prevented'

If you have a look at a file that will be on your computer called WRKGADM.EXE generally located in C:\Program Files\Microsoft Office\Office\1033 (depending on your installation path) double click it and you will see a dialog screen inviting you to create or join an existing workgroup.

This utility allows you to create and or join existing MDW files that you wish to use as the default for logging into Access.

Frankly.... to go into the in and outs of the security model in this thread would require extensive work by me (you could write a small book) whereas you can simply google a lot of it yourself and if you get stuck feel free to ask

To help you along here are a couple of links that illustrate what I am talking about

Gives a concise step by step with pics
http://www.databasedev.co.uk/access_security.html

A retail book pertinent sections of which are readable as pdf
http://books.google.com/books?id=qZq...CH8#PPA1088,M1


Regards

Jim :)
Dec 8 '07 #3
mixed
3
Thank you for quick response!
i havent solved my problem, but i will try to do so following yours instructions. Programming isn't my speciality so i have few more problems...

Thank you for now!
Dec 13 '07 #4

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

Similar topics

6
by: Bijesh | last post by:
Hi All, I've developed a Windows Service that acts as a remoting server (.NET Remoting). The client(user) is able to connect to the server and start a program by giving the executable path of...
8
by: Pete Wittig | last post by:
Hello, I am wondering if it is possible to create a networked application with C# that is seen as a windows user. For example, if Bob logged onto windows and then started the application, any...
7
by: jsale | last post by:
I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app i have made is running on IIS v6 and consists of a number of pages that allow the user to read information from the...
4
by: Trevor Andrew | last post by:
Hi There, Hopefully this isn't too difficult a question to express here. I have a 3 tier application. 1. Presentation Tier: ASP.NET web application. 2. Middle Tier: ASP.NET Web Services that...
5
by: Dean Slindee | last post by:
I store several application settings in the project's "app.config" file. I also have a form that reads these values and displays them in a listview so that the user can adjust them. My question...
3
by: Michael Glaesemann | last post by:
Hello all, Recently I've been thinking about different methods of managing users that log into a PostgreSQL-backed application. The users I'm thinking of are not necessarily DBAs: they're...
3
by: Lattis | last post by:
I have the following problem: User A is logged in to a windows 2000 terminal. He runs an application which runs under the credentials of a different user. If I try to see the current user...
2
by: =?Utf-8?B?d2luZHNpbQ==?= | last post by:
Hi, I have a C# program that need to know whether the user that run the application is administrative user or limited user. Are there any methods in C# I can use? -- windsim
12
by: Dilip | last post by:
Hi All I have a server based C# console application. This application must hide its console window when its launched out on the field. So I dutifully P/Invoke'd FindWindow/ShowWindow...
4
by: James R. Davis | last post by:
.... due to failure in receiving user's application data path. Okay, this simply cannot be a problem unique to me and I assume there is a straight forward solution, but it escapes me. I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.