/** * Auto-generated JavaScript stub for User_Model * DO NOT EDIT - This file is automatically regenerated */ class User_Model extends Rsx_Js_Model { static get name() { return 'User_Model'; } static ROLE_OWNER = 1; static ROLE_ADMIN = 2; static ROLE_MEMBER = 3; static ROLE_VIEWER = 4; static role_id_enum_val() { const data = {}; const order = []; data[1] = {"constant":"ROLE_OWNER","label":"Owner"}; order.push(1); data[2] = {"constant":"ROLE_ADMIN","label":"Admin"}; order.push(2); data[3] = {"constant":"ROLE_MEMBER","label":"Member"}; order.push(3); data[4] = {"constant":"ROLE_VIEWER","label":"Viewer"}; order.push(4); // Return Proxy that maintains sort order for enumeration return new Proxy(data, { ownKeys() { return order.map(String); }, getOwnPropertyDescriptor(target, prop) { if (prop in target) { return { enumerable: true, configurable: true, value: target[prop] }; } } }); } static role_id_label_list() { const values = {}; values[1] = 'Owner'; values[2] = 'Admin'; values[3] = 'Member'; values[4] = 'Viewer'; return values; } static role_id_enum_select() { const fullData = this.role_id_enum_val(); const data = {}; const order = []; // Extract labels from full data, respecting selectable flag for (const key in fullData) { const item = fullData[key]; if (item.selectable !== false && item.label) { data[key] = item.label; order.push(parseInt(key)); } } // Return Proxy that maintains sort order for enumeration return new Proxy(data, { ownKeys() { return order.map(String); }, getOwnPropertyDescriptor(target, prop) { if (prop in target) { return { enumerable: true, configurable: true, value: target[prop] }; } } }); } static USER_ROLE_READ_ONLY = 1; static USER_ROLE_STANDARD = 2; static USER_ROLE_ADMIN = 3; static USER_ROLE_BILLING_ADMIN = 4; static USER_ROLE_ROOT_ADMIN = 5; static user_role_id_enum_val() { const data = {}; const order = []; data[1] = {"constant":"USER_ROLE_READ_ONLY","label":"Read Only","order":1}; order.push(1); data[2] = {"constant":"USER_ROLE_STANDARD","label":"Standard","order":2}; order.push(2); data[3] = {"constant":"USER_ROLE_ADMIN","label":"Admin","order":3}; order.push(3); data[4] = {"constant":"USER_ROLE_BILLING_ADMIN","label":"Billing Admin","order":4}; order.push(4); data[5] = {"constant":"USER_ROLE_ROOT_ADMIN","label":"Root Admin","order":5}; order.push(5); // Return Proxy that maintains sort order for enumeration return new Proxy(data, { ownKeys() { return order.map(String); }, getOwnPropertyDescriptor(target, prop) { if (prop in target) { return { enumerable: true, configurable: true, value: target[prop] }; } } }); } static user_role_id_label_list() { const values = {}; values[1] = 'Read Only'; values[2] = 'Standard'; values[3] = 'Admin'; values[4] = 'Billing Admin'; values[5] = 'Root Admin'; return values; } static user_role_id_enum_select() { const fullData = this.user_role_id_enum_val(); const data = {}; const order = []; // Extract labels from full data, respecting selectable flag for (const key in fullData) { const item = fullData[key]; if (item.selectable !== false && item.label) { data[key] = item.label; order.push(parseInt(key)); } } // Return Proxy that maintains sort order for enumeration return new Proxy(data, { ownKeys() { return order.map(String); }, getOwnPropertyDescriptor(target, prop) { if (prop in target) { return { enumerable: true, configurable: true, value: target[prop] }; } } }); } /** * Fetch login_user relationship * @returns {Promise} Related model instance(s) or false */ async login_user() { if (!this.id) { shouldnt_happen('Cannot fetch relationship without id property'); } const response = await $.ajax({ url: `/_fetch_rel/User_Model/${this.id}/login_user`, method: 'POST', dataType: 'json' }); if (!response) return false; // Convert response to model instance(s) // Framework handles instantiation based on relationship type return response; } /** * Fetch site relationship * @returns {Promise} Related model instance(s) or false */ async site() { if (!this.id) { shouldnt_happen('Cannot fetch relationship without id property'); } const response = await $.ajax({ url: `/_fetch_rel/User_Model/${this.id}/site`, method: 'POST', dataType: 'json' }); if (!response) return false; // Convert response to model instance(s) // Framework handles instantiation based on relationship type return response; } /** * Fetch user_profile relationship * @returns {Promise} Related model instance(s) or false */ async user_profile() { if (!this.id) { shouldnt_happen('Cannot fetch relationship without id property'); } const response = await $.ajax({ url: `/_fetch_rel/User_Model/${this.id}/user_profile`, method: 'POST', dataType: 'json' }); if (!response) return false; // Convert response to model instance(s) // Framework handles instantiation based on relationship type return response; } }