spine-framework 0.3.60 → 0.3.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -345,9 +345,24 @@ function updateRegistrationConfig(appSlug: string, regConfig: RegistrationConfig
|
|
|
345
345
|
config.registration.apps = {}
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
// Try to load all roles from the app's seed data
|
|
349
|
+
let availableRoles: string[] = [regConfig.default_role] // Start with default role from manifest
|
|
350
|
+
|
|
351
|
+
try {
|
|
352
|
+
const rolesPath = join(PROJECT_ROOT, 'custom/apps', appSlug, 'seed/roles.json')
|
|
353
|
+
if (existsSync(rolesPath)) {
|
|
354
|
+
const rolesData = JSON.parse(readFileSync(rolesPath, 'utf8'))
|
|
355
|
+
if (Array.isArray(rolesData)) {
|
|
356
|
+
availableRoles = rolesData.map((role: any) => role.slug).filter(Boolean)
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
} catch (error) {
|
|
360
|
+
console.log(` ⚠️ Could not load roles from seed data, using default role only`)
|
|
361
|
+
}
|
|
362
|
+
|
|
348
363
|
// Add/update this app's registration entry with multi-role support
|
|
349
364
|
config.registration.apps[appSlug] = {
|
|
350
|
-
roles:
|
|
365
|
+
roles: availableRoles,
|
|
351
366
|
default_role: regConfig.default_role,
|
|
352
367
|
path: regConfig.redirect_path,
|
|
353
368
|
enabled: regConfig.enabled,
|
|
@@ -367,4 +382,5 @@ function updateRegistrationConfig(appSlug: string, regConfig: RegistrationConfig
|
|
|
367
382
|
|
|
368
383
|
saveSpineConfig(config)
|
|
369
384
|
console.log(` ✓ Updated spine.config.json registration for ${appSlug}`)
|
|
385
|
+
console.log(` ✓ Available roles: ${availableRoles.join(', ')}`)
|
|
370
386
|
}
|
|
@@ -214,7 +214,6 @@ export const validateToken = createHandler(async (_ctx, _body) => {
|
|
|
214
214
|
*/
|
|
215
215
|
export const completeRegistration = createHandler(async (ctx, body) => {
|
|
216
216
|
const { path, account_name, email, role_slug } = body
|
|
217
|
-
console.log('completeRegistration called with:', { path, account_name, email, role_slug })
|
|
218
217
|
|
|
219
218
|
if (!path || !email) {
|
|
220
219
|
throw new Error('path and email are required')
|
|
@@ -241,7 +240,6 @@ export const completeRegistration = createHandler(async (ctx, body) => {
|
|
|
241
240
|
|
|
242
241
|
// Resolve role from role_slug param, or fall back to member_admin/member lookup
|
|
243
242
|
const targetRoleSlug = role_slug || 'member'
|
|
244
|
-
console.log('Looking for role:', targetRoleSlug)
|
|
245
243
|
|
|
246
244
|
let { data: roles } = await adminDb
|
|
247
245
|
.from('roles')
|
|
@@ -250,11 +248,9 @@ export const completeRegistration = createHandler(async (ctx, body) => {
|
|
|
250
248
|
.limit(1)
|
|
251
249
|
|
|
252
250
|
let role = roles?.[0]
|
|
253
|
-
console.log('Found role:', role)
|
|
254
251
|
|
|
255
252
|
// If specific role not found, try member_admin or member as fallback
|
|
256
253
|
if (!role) {
|
|
257
|
-
console.log('Role not found, trying fallbacks...')
|
|
258
254
|
const { data: fallbackRoles } = await adminDb
|
|
259
255
|
.from('roles')
|
|
260
256
|
.select('id, slug')
|
|
@@ -262,7 +258,6 @@ export const completeRegistration = createHandler(async (ctx, body) => {
|
|
|
262
258
|
.order('slug')
|
|
263
259
|
.limit(1)
|
|
264
260
|
role = fallbackRoles?.[0]
|
|
265
|
-
console.log('Fallback role:', role)
|
|
266
261
|
}
|
|
267
262
|
|
|
268
263
|
// If no roles exist yet and no specific role was requested, create a default member role
|
|
@@ -238,7 +238,6 @@ export function RegisterPage() {
|
|
|
238
238
|
// Determine role from URL params or config
|
|
239
239
|
const urlRole = searchParams.get('role')
|
|
240
240
|
const urlApp = searchParams.get('app')
|
|
241
|
-
console.log('Role resolution:', { urlRole, urlApp, regConfig })
|
|
242
241
|
|
|
243
242
|
let effectiveRole = regConfig?.default_role || 'member'
|
|
244
243
|
|
|
@@ -257,8 +256,6 @@ export function RegisterPage() {
|
|
|
257
256
|
else if (urlRole) {
|
|
258
257
|
effectiveRole = urlRole
|
|
259
258
|
}
|
|
260
|
-
|
|
261
|
-
console.log('Effective role:', effectiveRole)
|
|
262
259
|
|
|
263
260
|
if (domainMatchChoice === 'join') {
|
|
264
261
|
// Join existing account as access_request
|