Denied changes for clients

Discussion in 'Developers' Forum' started by Croydon, Aug 15, 2012.

  1. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    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.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    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.
     
  3. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    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.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    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.
     
  5. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    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
     

Share This Page