Working on improved default permissions and allow control per site and site domains.
This commit is contained in:
@@ -162,6 +162,31 @@ export async function load({ fetch, params, parent, route, url }) { // params, r
|
||||
ae_loc_init['site_google_tracking_id'] = site_domain_results.google_tracking_id;
|
||||
ae_loc_init['site_access_code_kv'] = site_domain_results.access_code_kv_json;
|
||||
ae_loc_init['site_cfg_json'] = site_domain_results.cfg_json;
|
||||
ae_loc_init['site_access_key'] = site_domain_results.access_key; // This is the general site access key
|
||||
ae_loc_init['site_domain_access_key'] = site_domain_results.site_domain_access_key; // This is specific to a (sub)domain.
|
||||
|
||||
if (!ae_loc_init['site_access_key'] && !ae_loc_init['site_domain_access_key']) {
|
||||
ae_loc_init['key_checked'] = true;
|
||||
ae_loc_init['allow_access'] = true; // No access key is required here.
|
||||
} else {
|
||||
let access_key = url.searchParams.get('key');
|
||||
console.log(`root layout.ts: access_key = `, access_key);
|
||||
if (access_key) {
|
||||
if (access_key == ae_loc_init['site_access_key']) {
|
||||
ae_loc_init['key_checked'] = ae_loc_init['site_access_key'];
|
||||
ae_loc_init['allow_access'] = ae_loc_init['site_access_key'];
|
||||
} else if (access_key == ae_loc_init['site_domain_access_key']) {
|
||||
ae_loc_init['key_checked'] = ae_loc_init['site_domain_access_key'];
|
||||
ae_loc_init['allow_access'] = ae_loc_init['site_domain_access_key'];
|
||||
} else {
|
||||
ae_loc_init['key_checked'] = true;
|
||||
ae_loc_init['allow_access'] = false;
|
||||
}
|
||||
} else {
|
||||
ae_loc_init['key_checked'] = true;
|
||||
// ae_loc_init['allow_access'] = false; // An access key is required at this point.
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`root layout.ts: Returning account_id = `, site_domain_results.account_id_random);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user