Group:  Microsoft Access ยป microsoft.public.access.gettingstarted
Thread: Security Question

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Security Question
"Mommio2" <mommio2[ at ]insightbb.com> 29.09.2006 20:56:09
Have just finished my first database for the elementary school where I
teach. We have set the permissions so that the teachers have read and
read/execute access, while the other administrators and I have full control.
On my menu page, I have a button for "Add Student". Is there a way to have
this button disabled if a teacher logs on and enabled for an administrator?
Thanks!


RE: Security Question
KARL DEWEY 29.09.2006 23:35:01
Why not give the teacher a frontend without the button?

"Mommio2" wrote:

[Quoted Text]
> Have just finished my first database for the elementary school where I
> teach. We have set the permissions so that the teachers have read and
> read/execute access, while the other administrators and I have full control.
> On my menu page, I have a button for "Add Student". Is there a way to have
> this button disabled if a teacher logs on and enabled for an administrator?
> Thanks!
>
>
>
Re: Security Question
"Jeff Boyce" <nonsense[ at ]nonsense.com> 29.09.2006 23:36:59
Do you currently have a way to tell who is logging on? Does your
application run over a LAN, with a front-end on the users' PCs and the
back-end on a server? Do users log in to that LAN/network?

Those would all be ways of determining what type of person logged on, then
using that to enable/disable the command button.

Regards

Jeff Boyce
Microsoft Office/Access MVP


"Mommio2" <mommio2[ at ]insightbb.com> wrote in message
news:Oo3%23wmA5GHA.4504[ at ]TK2MSFTNGP04.phx.gbl...
[Quoted Text]
> Have just finished my first database for the elementary school where I
> teach. We have set the permissions so that the teachers have read and
> read/execute access, while the other administrators and I have full
> control. On my menu page, I have a button for "Add Student". Is there a
> way to have this button disabled if a teacher logs on and enabled for an
> administrator? Thanks!
>


Re: Security Question
"Mommio2" <mommio2[ at ]insightbb.com> 30.09.2006 12:08:49
Thanks, but I don't know HOW to do that. Here is how it is set up. Database
is on the server. Each teacher computer on the network has a link to the
mdb file. We have the server permissions set up for teachers to have
read/execute and admins to have full control. How does Access know which is
logging on so it can "fade out" the button if it is a teacher? Is this the
correct way to set it up, or am I way off?


"Jeff Boyce" <nonsense[ at ]nonsense.com> wrote in message
news:%23kFCpAC5GHA.2464[ at ]TK2MSFTNGP06.phx.gbl...
[Quoted Text]
> Do you currently have a way to tell who is logging on? Does your
> application run over a LAN, with a front-end on the users' PCs and the
> back-end on a server? Do users log in to that LAN/network?
>
> Those would all be ways of determining what type of person logged on, then
> using that to enable/disable the command button.
>
> Regards
>
> Jeff Boyce
> Microsoft Office/Access MVP
>
>
> "Mommio2" <mommio2[ at ]insightbb.com> wrote in message
> news:Oo3%23wmA5GHA.4504[ at ]TK2MSFTNGP04.phx.gbl...
>> Have just finished my first database for the elementary school where I
>> teach. We have set the permissions so that the teachers have read and
>> read/execute access, while the other administrators and I have full
>> control. On my menu page, I have a button for "Add Student". Is there a
>> way to have this button disabled if a teacher logs on and enabled for an
>> administrator? Thanks!
>>
>
>


Re: Security Question
"Douglas J. Steele" <NOSPAM_djsteele[ at ]NOSPAM_canada.com> 30.09.2006 17:22:49
Assuming you haven't applied Access User-Level Security, you can use the
code from http://www.mvps.org/access/api/api0008.htm at "The Access Web" to
determine their network ID.

If you have applied ULS, you can use CurrentUser()

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Mommio2" <mommio2[ at ]insightbb.com> wrote in message
news:uc0%23vkI5GHA.4196[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text]
> Thanks, but I don't know HOW to do that. Here is how it is set up.
> Database is on the server. Each teacher computer on the network has a
> link to the mdb file. We have the server permissions set up for teachers
> to have read/execute and admins to have full control. How does Access
> know which is logging on so it can "fade out" the button if it is a
> teacher? Is this the correct way to set it up, or am I way off?
>
>
> "Jeff Boyce" <nonsense[ at ]nonsense.com> wrote in message
> news:%23kFCpAC5GHA.2464[ at ]TK2MSFTNGP06.phx.gbl...
>> Do you currently have a way to tell who is logging on? Does your
>> application run over a LAN, with a front-end on the users' PCs and the
>> back-end on a server? Do users log in to that LAN/network?
>>
>> Those would all be ways of determining what type of person logged on,
>> then using that to enable/disable the command button.
>>
>> Regards
>>
>> Jeff Boyce
>> Microsoft Office/Access MVP
>>
>>
>> "Mommio2" <mommio2[ at ]insightbb.com> wrote in message
>> news:Oo3%23wmA5GHA.4504[ at ]TK2MSFTNGP04.phx.gbl...
>>> Have just finished my first database for the elementary school where I
>>> teach. We have set the permissions so that the teachers have read and
>>> read/execute access, while the other administrators and I have full
>>> control. On my menu page, I have a button for "Add Student". Is there a
>>> way to have this button disabled if a teacher logs on and enabled for an
>>> administrator? Thanks!
>>>
>>
>>
>
>


Re: Security Question
Ken Sheridan 30.09.2006 17:31:02
To get the user name of the currently logged in user add the following module
to your database:

''''module starts''''
Option Compare Database
Option Explicit

Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal _
lpBuffer As String, nSize As Long) As Long


Public Function GetUser() As String

Dim strBuffer As String
Dim lngSize As Long, lngRetVal As Long

lngSize = 199
strBuffer = String$(200, 0)

lngRetVal = GetUserName(strBuffer, lngSize)

GetUser = Left$(strBuffer, lngSize - 1)

End Function
''''module ends''''

Add a table Users to your database with two text columns UserName and
GroupName. For each user add a row with their user name and 'group' name
e.g. Teachers or Admins. Strictly speaking you should add another table
Groups with column GroupName, with two rows with values Teachers and Admins,
and relate the two tables, enforcing referential integrity. This prevents a
group not in the Groups table being entered in Users (by a simple typo for
instance).

In the form's Open event procedure put:

Dim strUser As String, strCriteria As String

strUser = GetUser()
strCriteria = """" & strUser & """ IN (SELECT UserName " & _
"FROM Users WHERE GroupName = ""Sheridan"")"

Me.[cmdAddStudent].Enabled = Not IsNull(DLookup("UserName", "Users",
strCriteria))

where cmdAddStudent is the name of the button. By using a subquery within
the DLookup function's criteria this caters for a user possibly being in both
the Teachers and Admins groups. It will work even if this isn't the case,
however.

From what you say it does sound like you are using a single .mdb file
installed in a shared folder on the server. This is not a good approach in a
multi-user environment. What you should have is a front end on each local
machine, containing the forms, queries, reports etc and a back end file on
the server containing just the tables. You can change your database to this
quite easily by using the built in database splitter wizard. This will
create a new back end and links to its tables in the front end file. You
should then move the back end file to a suitable folder on the server and by
using the built in Linked table manager in the front end refresh the links to
the back end in its new location. A separate copy of the front end should
then be installed on each local workstation along with Access itself. I have
actually seen one of my applications installed like this but with Access
itself on the server. Although not normally recommended it did seem to run
efficiently. Nevertheless it would be better to install Access on each
workstation.

The form of security you are using is very weak as far as the database is
concerned and could be easily subverted by a user. Access doe include its
own user and group security implementation, details of which you can find at:

http://support.microsoft.com/default.aspx?scid=%2Fsupport%2Faccess%2Fcontent%2Fsecfaq.asp


Ken Sheridan
Stafford,

"Mommio2" wrote:

[Quoted Text]
> Thanks, but I don't know HOW to do that. Here is how it is set up. Database
> is on the server. Each teacher computer on the network has a link to the
> mdb file. We have the server permissions set up for teachers to have
> read/execute and admins to have full control. How does Access know which is
> logging on so it can "fade out" the button if it is a teacher? Is this the
> correct way to set it up, or am I way off?
>
>
> "Jeff Boyce" <nonsense[ at ]nonsense.com> wrote in message
> news:%23kFCpAC5GHA.2464[ at ]TK2MSFTNGP06.phx.gbl...
> > Do you currently have a way to tell who is logging on? Does your
> > application run over a LAN, with a front-end on the users' PCs and the
> > back-end on a server? Do users log in to that LAN/network?
> >
> > Those would all be ways of determining what type of person logged on, then
> > using that to enable/disable the command button.
> >
> > Regards
> >
> > Jeff Boyce
> > Microsoft Office/Access MVP
> >
> >
> > "Mommio2" <mommio2[ at ]insightbb.com> wrote in message
> > news:Oo3%23wmA5GHA.4504[ at ]TK2MSFTNGP04.phx.gbl...
> >> Have just finished my first database for the elementary school where I
> >> teach. We have set the permissions so that the teachers have read and
> >> read/execute access, while the other administrators and I have full
> >> control. On my menu page, I have a button for "Add Student". Is there a
> >> way to have this button disabled if a teacher logs on and enabled for an
> >> administrator? Thanks!
> >>
> >
> >
>
>
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net