@@ -146,7 +146,14 @@ function onShowEnd() {
146146 }
147147 if ($ this ->_childdomain_type == 'subdomain ' ) $ app ->tpl ->setVar ("domain " , $ this ->dataRecord ["domain " ]);
148148
149- if ($ _SESSION ["s " ]["user " ]["typ " ] == 'admin ' ) {
149+ $ client_group_id = $ app ->functions ->intval ($ _SESSION ["s " ]["user " ]["default_group " ]);
150+ if ($ _SESSION ["s " ]["user " ]["typ " ] != 'admin ' && !$ app ->auth ->has_clients ($ _SESSION ['s ' ]['user ' ]['userid ' ])) {
151+ $ client = $ app ->db ->queryOneRecord ("SELECT client.limit_ssl_letsencrypt FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ? " , $ client_group_id );
152+ $ app ->tpl ->setVar ('limit_ssl_letsencrypt ' , $ client ['limit_ssl_letsencrypt ' ]);
153+ } elseif ($ _SESSION ["s " ]["user " ]["typ " ] != 'admin ' && $ app ->auth ->has_clients ($ _SESSION ['s ' ]['user ' ]['userid ' ])) {
154+ $ client = $ app ->db ->queryOneRecord ("SELECT client.limit_ssl_letsencrypt FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ? " , $ client_group_id );
155+ $ app ->tpl ->setVar ('limit_ssl_letsencrypt ' , $ client ['limit_ssl_letsencrypt ' ]);
156+ } else {
150157 // Directive Snippets
151158 $ proxy_directive_snippets = $ app ->db ->queryAllRecords ("SELECT * FROM directive_snippets WHERE type = 'proxy' AND active = 'y' " );
152159 $ proxy_directive_snippets_txt = '' ;
@@ -157,6 +164,7 @@ function onShowEnd() {
157164 }
158165 if ($ proxy_directive_snippets_txt == '' ) $ proxy_directive_snippets_txt = '------ ' ;
159166 $ app ->tpl ->setVar ("proxy_directive_snippets_txt " , $ proxy_directive_snippets_txt );
167+ $ app ->tpl ->setVar ('limit_ssl_letsencrypt ' , 'y ' );
160168 }
161169
162170 $ app ->tpl ->setVar ('childdomain_type ' , $ this ->_childdomain_type );
@@ -208,6 +216,15 @@ function onSubmit() {
208216 $ app ->tform ->errorMessage .= $ app ->tform ->lng ("error_proxy_requires_url " )."<br /> " ;
209217 }
210218
219+
220+ if ($ _SESSION ["s " ]["user " ]["typ " ] != 'admin ' ) {
221+ // Get the limits of the client
222+ $ client_group_id = $ app ->functions ->intval ($ _SESSION ["s " ]["user " ]["default_group " ]);
223+ $ client = $ app ->db ->queryOneRecord ("SELECT limit_ssl_letsencrypt FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ? " , $ client_group_id );
224+ if ($ client ['limit_ssl_letsencrypt ' ] != 'y ' ) $ this ->dataRecord ['ssl_letsencrypt_exclude ' ] = 'n ' ;
225+ }
226+
227+
211228 // Set a few fixed values
212229 $ this ->dataRecord ["type " ] = ($ this ->_childdomain_type == 'subdomain ' ? 'subdomain ' : 'alias ' );
213230 $ this ->dataRecord ["server_id " ] = $ parent_domain ["server_id " ];
0 commit comments