HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Developers' Forum (http://www.howtoforge.com/forums/forumdisplay.php?f=33)
-   -   Denied changes for clients (http://www.howtoforge.com/forums/showthread.php?t=58272)

Croydon 15th August 2012 10:49

Denied changes for clients
 
Hi folks :)

Would it be possible (short-term) to implement the following:
If a client can not change some values of a website, like the php mode or php version, this input field or select box should be shown but disabled.
I have no clue what I would have to change to achieve this, so maybe someone who known can implement it - or give me some hints.

A client of mine tried to change the php version from default to php 5.4.5 (that I set up as an additional php version) but the setting switches back to default after saving without any message.
If I change the setting then it works.

I first thought it was an error but then I realized that on all other websites of this client he can change the php version without problems.
So I think it is because I created one of this websites as admin and he is not allowed to overwrite the settings, right? But then, there should be an error message or - even better - the fields should be disabled.

till 15th August 2012 11:10

Quote:

So I think it is because I created one of this websites as admin and he is not allowed to overwrite the settings, right?
Yes, thats right. This is a feature in ISPConfig to protect the website. Sites that were created by a dmin for a client can only be changed by the admin while sites that had been created by the client himself can be changed by the client.

You can see the difference in permissions in the sys_perm_group field of the web_domain table. 'riud' indicates that the client can save the changes in the form while 'ru' indicates that he cant save the changes. The variable 'sys_perm_group' is available in the template if I remember correctly, so it should be possible to either show a a message in the template that its read only or to disable the fields with jquery. This message or field disabling should only happen to clients, so it should be combined with a "is_admin" if statement in the template.

Croydon 15th August 2012 11:43

Thank you.

What happens if I create a web site using the remoting lib?
Is it created with admin as owner, too?

I need to create all websites for the clients but they should be able to edit settings like php version.
Same with emails and ftp and so on.

till 15th August 2012 11:46

Quote:

What happens if I create a web site using the remoting lib?
Is it created with admin as owner, too?
You ca set the permissions in the way you want them with the remote lib, its alow level api, so you can control everything in detail. So it depends on your code which permissions are used for which record that you insert.

Croydon 17th August 2012 17:51

The sys_perm_group variable was not available.
I realized that a tab can have a "readonly" setting so I added this to the template as "readonly_tab" via the tform class.
In the default theme the input fields now are disabled using jQuery if a client does not have edit rights (readonly tab).

Changes are online in svn rev 3371


All times are GMT +2. The time now is 22:21.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.