Database login

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Nibor
Posts: 18
Joined: Wed Nov 21, 2012 12:13 pm

Database login

Post by Nibor » Wed Nov 28, 2012 12:37 pm

Hi,
maybe someone can help me with my little LiveCode problem.
I want to create a tool where you can write data into your database and view the data which is in your database.
Well this isn't the problem.. the problem is, that this tool should have a login for seperate users
and every user got it's specific rights.
For example:
User 1 can only see the data which is in the database
User 2 can create new database entry but is not allowed to delete
User 3 can delete and see the data
User admin is allowed to do everything

I can't find anything in the dictonary or something that helps me
to connect the rights with the specific usergroups.

(I'm using mssql windows 64bit
don't know it it matters)

regards

Nibor

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Database login

Post by Klaus » Wed Nov 28, 2012 1:26 pm

Hi Nibor,

1. welcome to the forum :D

2. I would put the current user (1,2,3, or admin) into a global variable or custom property and en-/disable
your buttons "new entry" resp. "delete entry" accordingly, maybe in an "pre-/opencard" script. Know what I mean?

A quick and clean solution I think 8)


Best

Klaus

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Database login

Post by Mark » Wed Nov 28, 2012 1:57 pm

Hi Nibor,

MSSQL has a built-in feature for this. You can create users with special permissions. You set these permissions when executing the CREATE USER command. Once you have created the users, you can log in to your database with these users and you're sure that each user can only do what you allow them to do.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Nibor
Posts: 18
Joined: Wed Nov 21, 2012 12:13 pm

Re: Database login

Post by Nibor » Wed Nov 28, 2012 2:37 pm

Klaus wrote:Hi Nibor,

1. welcome to the forum :D

2. I would put the current user (1,2,3, or admin) into a global variable or custom property and en-/disable
your buttons "new entry" resp. "delete entry" accordingly, maybe in an "pre-/opencard" script. Know what I mean?

A quick and clean solution I think 8)


Best

Klaus
Hi Klaus,
it is a good solution, but in my case there are more than one user in each group.
For example:
user1 is in group "admin"
user2 is in group "admin"
user3-7 is in group "create; no delete"
user8-10 is in group "only view"

as far as I understand your solution, I would have just one user per group.

I tried to create a new table in my database and added a few new users with a column for group and a column for userid.
In another table I added the userid aswell as the username, name and the password.
Now I would like to connect these tables in LiveCode so that each user can do what I gave them the rights for.
I'm able to add new users with password and so on.

kind regards

Nibor

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Database login

Post by Klaus » Wed Nov 28, 2012 3:27 pm

Nibor wrote:Hi Klaus,
it is a good solution, but in my case there are more than one user in each group.
For example:
user1 is in group "admin"
user2 is in group "admin"
user3-7 is in group "create; no delete"
user8-10 is in group "only view"
as far as I understand your solution, I would have just one user per group.
My solution was just a proposal and could certainly be enhanced to fit your needs!
Just check the GROUP in your case and not the users 8)
Nibor wrote:I tried to create a new table in my database and added a few new users with a column for group and a column for userid.
In another table I added the userid aswell as the username, name and the password.
Now I would like to connect these tables in LiveCode so that each user can do what I gave them the rights for.
I'm able to add new users with password and so on.
Hm, I thought you meant a Livecode solution, but you come up with a "real" database solution :D

Can't you connect to the correct tables according to the technique explained above?
Or just create different "edit" or "access" cards for the different groups?
Know what I mean?


Best

Klaus

Post Reply