chore(TALE-29): remove acl from integration/context

This commit is contained in:
Aarnav Tale 2024-08-24 10:12:30 -04:00
parent a72a3d6e5f
commit 690b52d8c6
No known key found for this signature in database
8 changed files with 1 additions and 62 deletions

View File

@ -10,7 +10,6 @@ import TabLink from './TabLink'
interface Properties {
readonly data?: {
acl: HeadplaneContext['acl']
config: HeadplaneContext['config']
user?: SessionData['user']
}

View File

@ -88,36 +88,6 @@ export default createIntegration<Context>({
return context.client !== undefined
},
onAclChange: async (context) => {
if (!context.client || !context.container) {
return
}
log.info('INTG', 'Sending SIGHUP to Headscale via Docker')
let attempts = 0
while (attempts <= context.maxAttempts) {
const response = await context.client.request({
method: 'POST',
path: `/v1.30/containers/${context.container}/kill?signal=SIGHUP`,
})
if (response.statusCode !== 204) {
if (attempts < context.maxAttempts) {
attempts++
await setTimeout(1000)
continue
}
const stringCode = response.statusCode.toString()
const body = await response.body.text()
throw new Error(`API request failed: ${stringCode} ${body}`)
}
break
}
},
onConfigChange: async (context) => {
if (!context.client || !context.container) {
return

View File

@ -3,7 +3,6 @@ export interface IntegrationFactory<T = any> {
name: string
context: T
isAvailable: (context: T) => Promise<boolean> | boolean
onAclChange?: (context: T) => Promise<void> | void
onConfigChange?: (context: T) => Promise<void> | void
}

View File

@ -177,15 +177,6 @@ export default createIntegration<Context>({
}
},
onAclChange: (context) => {
if (!context.pid) {
return
}
log.info('INTG', 'Sending SIGHUP to Headscale')
kill(context.pid, 'SIGHUP')
},
onConfigChange: (context) => {
if (!context.pid) {
return

View File

@ -70,14 +70,5 @@ export default createIntegration<Context>({
log.error('INTG', 'Failed to read /proc')
return false
}
},
onAclChange: (context) => {
if (!context.pid) {
return
}
log.info('INTG', 'Sending SIGHUP to Headscale')
kill(context.pid, 'SIGHUP')
},
}
})

View File

@ -82,10 +82,6 @@ export async function action({ request }: ActionFunctionArgs) {
})
}
if (context.integration?.onAclChange) {
await context.integration.onAclChange(context.integration.context)
}
return json({ success: true })
}

View File

@ -35,7 +35,6 @@ export async function loader({ request }: LoaderFunctionArgs) {
const context = await loadContext()
return {
acl: context.acl,
config: context.config,
user: session.get('user'),
}

View File

@ -22,11 +22,6 @@ export interface HeadplaneContext {
write: boolean
}
acl: {
read: boolean
write: boolean
}
oidc?: {
issuer: string
client: string
@ -69,7 +64,6 @@ export async function loadContext(): Promise<HeadplaneContext> {
cookieSecret,
integration: await loadIntegration(),
config: contextData,
acl: await checkAcl(config),
oidc: await checkOidc(config),
}