Subject: | Re: Sessions
| Date: | Wed, 27 Sep 2023 14:21:02 +1000
| From: | Tom Krieg <tomkIGNORE@CAPSsdassociates.com.au>
| Newsgroups: | pnews.paradox-programming
|
You can do that by having a user's rights table that stores a bitmap
(just an integer number). Then when a user logs in, they retrieve their
"rights" and use this number to pass to every form etc. The form works
out, from the bitmap, whether the user has rights to use it.
You could set a password on the users table and issue it when the user
logs on to retrieve their rights. Only one password on one table needed.
For example:
Customer form is 801
Supplier Form is 802
Item form is 803
where 8 is the menu group (maintenance) and the rest is the form ID. All
this information is stored per user. With a 0 for allowed or a 1 for no.
For the menu group 8, if the user was allowed to access the customer
form and the supplier form, his bitmap would be 011. I.e. the number 3.
(least significant digit is on the right). Just pass 3 with each user's
request for a maintenance form and let the form decode the number and
check if it's in the list. (Real life numbers will be larger).
For example, let's build the number for 10 forms.
Initialize the rights number to 0.
if form(1).isAllowed() then rights = rights +1 endif
if form(2).isAllowed() then rights = rights +2 endif
if form(3).isAllowed() then rights = rights +4 endif
if form(4).isAllowed() then rights = rights +8 endif
if form(5).isAllowed() then rights = rights +16 endif
if form(6).isAllowed() then rights = rights +32 endif
if form(7).isAllowed() then rights = rights +64 endif
if form(8).isAllowed() then rights = rights +128 endif
if form(9).isAllowed() then rights = rights +256 endif
if form(10).isAllowed() then rights = rights +512 endif
the resulting number is a bitmap of the user permissions.
To decode the bitmap. initialize an array of logical with 10 entries to
false.
if rights > 511 then
rights = rights - 512
array(10) = true
end if
if rights > 255 then
rights = rights - 256
array[9] = true
end if
and so on, until
if rights > 0 then
rights = rights - 1
array[1] = true
end if
Of course you'll need an administrator's form to create and maintain
user rights.
On 27/09/2023 3:35 am, Peter wrote:
> My security system is not
> about protecting tables (I got that message long ago), it is only about
> limiting users access to/in forms and other features that they do not
> have rights to.
|