PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → How to implement an user control access
How to implement an user control access
Débuté par Jordi, 07 fév. 2005 17:16 - 9 réponses
Posté le 07 février 2005 - 17:16
hello everybody,
I've an application in deploying mode and I would like to implement an user control access. This option would be "customizable", so from the menu options, the administrator would grant the access to the desired menu options.
Has anybody something similar?
Does anybody know how retrieve dinamycally the ID of every menu option?.
Thanks in advance.
Jordi
Posté le 08 février 2005 - 02:13
hello everybody,
I've an application in deploying mode and I would like to implement an user control access. This option would be "customizable", so from the menu options, the administrator would grant the access to the desired menu options.
Has anybody something similar?
Does anybody know how retrieve dinamycally the ID of every menu option?.
Thanks in advance.
Jordi

Sounds like WinDev's built in User Groupware. Have you read up on it in the Help?
Art
Posté le 08 février 2005 - 12:35
Thanks for your answer, Art.
I don't know where I can find information about it.
Please, can you tell me where this information is?
Another question. Groupware is for development or deploying?
I'm working with WD5.5b.
Regards
hello everybody,
I've an application in deploying mode and I would like to implement an user control access. This option would be "customizable", so from the menu options, the administrator would grant the access to the desired menu options.
Has anybody something similar?
Does anybody know how retrieve dinamycally the ID of every menu option?.
Thanks in advance.
Jordi
Sounds like WinDev's built in User Groupware. Have you read up on it in the Help?

Art
Posté le 08 février 2005 - 16:32
G'day Jordi
>Does anybody know how retrieve dinamycally the ID of every menu option?.
In V5.5 you can create a counting loop to retrieve the menus defined on a specific window. I am not sure if it can be done for the entire project.
Try something like :
MenuCount is int = 0
FOR MenuCount = 1 TO 1000
IF NoSpace(MenuLabel(Windowname,MenuCount)) <> ""
//Do something here to store the menu name and number to an array or file
END
END
The 1000 is an arbitrary number, you could adjust it to equal the highest menu number issued in your project, though I seem to remember some issues in V5.5 with large menu counts.
Regards
Al
Posté le 08 février 2005 - 16:51
G'day Jordi
Most of us have moved on from v5.5 so for future reference can you preface your requests with [5.5] in the subject. It will save a lot of time and inappropriate advice.
Regards
Al
Posté le 08 février 2005 - 23:44
Jordi,
In 5.5 it is easy to make up a login screen, then use that information to choose the correct level for the user. You can then use the level variable to control groups on windows and have the options you want to control within those groups.
For instance, a high level user can do all, next level less and so on, without going to the menu level. All controlled by the visibility of buttons on windows.
As a start I'll email you the window and code for the login if you like.
Gill
hello everybody,
I've an application in deploying mode and I would like to implement an user control access. This option would be "customizable", so from the menu options, the administrator would grant the access to the desired menu options.
Has anybody something similar?
Does anybody know how retrieve dinamycally the ID of every menu option?.
Thanks in advance.
Jordi
Posté le 10 février 2005 - 19:57
Al, many thanks for your suggestion but unfortunately, it doesn't work. Remember that I'm working with v5.5.
I try run it within the WD developer environment and I get a message telling that "the window name is not valid" when the program try to execute the MenuLabel instruction but the window exists.
Is it necessary build the executable?

Thanks again.
G'day Jordi
Does anybody know how retrieve dinamycally the ID of every menu option?.
In V5.5 you can create a counting loop to retrieve the menus defined on a specific window. I am not sure if it can be done for the entire project.

Try something like :
MenuCount is int = 0
FOR MenuCount = 1 TO 1000
IF NoSpace(MenuLabel(Windowname,MenuCount)) <> ""
//Do something here to store the menu name and number to an array or file
END
END
The 1000 is an arbitrary number, you could adjust it to equal the highest menu number issued in your project, though I seem to remember some issues in V5.5 with large menu counts.
Regards
Al
Posté le 10 février 2005 - 22:03
G'day Jordi
I checked back to some old V5.5 code and it works ok.
The WindowName parameter should be either a string variable holding the current window name or the actual window name enclosed in quotes. You could probably use CurrentWin()as the window name.
In the help this method is described as Syntax 1: Retrieve a menu item caption
Regards
Al
Posté le 11 février 2005 - 12:45
Aaaah, OK Al.
I was trying to retrieve all the menu option from the main window for to display it in a grid in another window.
I need to execute a window with a grid showing all the menu options I have in my menu application.
Can I do this?
Regards
G'day Jordi
I checked back to some old V5.5 code and it works ok.
The WindowName parameter should be either a string variable holding the current window name or the actual window name enclosed in quotes. You could probably use CurrentWin()as the window name.
In the help this method is described as Syntax 1: Retrieve a menu item caption
Regards
Al
Posté le 11 février 2005 - 14:30
G'day Jordi
I don't think you can do it with Windev commands in V5.5 because there are no enumerate commands like there are in V8
I used to do exactly as you require in my old V5.5 programs but I had a list of windows in a file, and when I opened a window I passed the window name to this file to test permissions, colours, sizes etc. A related table held the menu options and access rights for the menus and also the buttons (new,delete etc).
If you had such a list of the windows then you can build a list of menu options for the related menu table by simply passing the window names into the menucount loop and it is easy to construct a table of these entries to allow users to access them. You need a set of global procedures that you call at the opening of each window to make it all work.
Considering the amount of work you will need to do, it may be easier to upgrade to V8 where all this work is done for you in the Groupware and can be installed into a project in seconds.
Regards
Al