gitoria

ident

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit6fad3bd26fad3bd2Merge branch 'f3-codestep' into mainIdent6fad3bd2/components/access.hl

21.9 KB

  1. // components/access.hl — `/access`: WHO MAY ACT IN WHICH OF YOUR APPS (ident#27; the screens he approved 2026-10-29, mockups 027-01…08).
  2. // The matrix (identity × app), "Give access" in three steps (who → which apps, level, label → the key, shown once), a cell's sheet
  3. // (since, last use, level, rotate, revoke). The account stays signed in as itself: no logging out and in. The server side is lib/access.hl.
  4. //
  5. // The faces' names start with `acc…`: a face is found by its EVENT NAME across all files (hl:web).
  6. parent './main.hl'
  7. import { accountOfSession } from '../lib/accounts.hl'
  8. import { matrix, pickList, cellOf, giveAccess, revokeAccess, setLevel, rotateKey } from '../lib/access.hl'
  9. import { siteName } from '../project.hl'
  10. session = null
  11. me = accountOfSession(&session)
  12. signedIn = me != null
  13. signedOut = me == null
  14. data = me != null ? matrix(me.id) : { apps = [] rows = [] never = [] hasNever = false }
  15. apps = data.apps
  16. rows = data.rows
  17. never = data.never
  18. hasNever = data.hasNever
  19. noApps = apps.length == 0
  20. hasApps = apps.length > 0
  21. __title = siteName + ' | access'
  22. // WHICH SCREEN: 'overview' | 'who' (step 1) | 'where' (step 2) | 'key' (step 3)
  23. screen = 'overview'
  24. isOverview = true
  25. isWho = false
  26. isWhere = false
  27. isKey = false
  28. pickRows = []
  29. pickId = ''
  30. newMode = false
  31. newName = ''
  32. tickRows = []
  33. allOn = false
  34. level = 'write'
  35. writeCls = 'seg on'
  36. readCls = 'seg'
  37. newCls = 'newone'
  38. doneLabel = 'Done'
  39. label = ''
  40. // THE KEY, shown once (never kept by the server)
  41. keyText = ''
  42. keyWho = ''
  43. keyApps = []
  44. hasKey = false
  45. newKeyNeeded = true
  46. hasKeyText = false
  47. noKeyText = true
  48. doneText = ''
  49. // the cell's sheet
  50. sheetOpen = false
  51. sheet = null
  52. message = ''
  53. notice = ''
  54. View {
  55. accessPage {
  56. if (signedOut) {
  57. h1 { "Access" }
  58. p { id = "signinfirst" class = "lead" "Sign in to ident first: " a { href = "/" "sign in" } "." }
  59. }
  60. if (signedIn) {
  61. if (isOverview) {
  62. section { id = "accesssection"
  63. h1 { "Access" }
  64. p { class = "lead" "Which identity may act in which of your apps." }
  65. if (noApps) { p { id = "noapps" class = "lead" "No apps yet. Register an app first, then give an identity access to it: " a { href = "/apps" "your apps" } "." } }
  66. if (hasApps) {
  67. accessMatrix { table { id = "matrix"
  68. thead { tr { th { } for (a of apps) { th { class = "appname" a.name } } } }
  69. tbody {
  70. for (r of rows) {
  71. tr { class = "idrow"
  72. th { class = "who" a { class = "whoname" href = r.href r.label } whoSub { r.sub } }
  73. for (c of r.cells) {
  74. td { button { type = "button" class = c.cls value = c.value title = c.tip 'aria-label' = c.tip
  75. on click(e) { emit accOpenCell(e.target.value) }
  76. c.glyph } }
  77. }
  78. }
  79. }
  80. }
  81. } }
  82. matrixKey { id = "legend" "● agent key works · ◐ you log in there · ○ no access. Tap a cell for since / last use / revoke." }
  83. }
  84. if (hasNever) {
  85. h2 { "Never used" }
  86. ul { id = "neverused"
  87. for (n of never) {
  88. li { class = "never"
  89. neverMain { neverName { n.text } neverLine { n.line } }
  90. button { type = "button" class = "quiet small neverrevoke" value = n.value "Revoke" on click(e) { emit accRevokeNever(e.target.value) } }
  91. }
  92. }
  93. }
  94. }
  95. if (hasApps) { button { id = "give" type = "button" class = "primary" "+ Give access" on click(e) { emit accStartGive(e) } } }
  96. }
  97. }
  98. if (isWho) {
  99. section { id = "whosection"
  100. stepLabel { "STEP 1 OF 3" }
  101. h1 { "Who gets access?" }
  102. ul { id = "picklist"
  103. for (p of pickRows) {
  104. li { class = p.cls
  105. button { type = "button" class = "pick" value = p.id on click(e) { emit accPick(e.currentTarget.value) }
  106. avatarDot { class = p.dot p.initial }
  107. pickMain { pickName { p.label } pickSub { p.sub } }
  108. pickMark { p.mark }
  109. }
  110. }
  111. }
  112. li { class = newCls
  113. button { type = "button" id = "newidentity" class = "pick" on click(e) { emit accPickNew(e) }
  114. avatarDot { class = "plus" "+" }
  115. pickMain { pickName { "New identity" } pickSub { "just a name, nothing else needed" } }
  116. }
  117. }
  118. }
  119. if (newMode) {
  120. label { "Name"
  121. input { id = "newname" name = "newname" maxlength = "60" autocomplete = "off" placeholder = "e.g. Hermes" value = newName on input(e) { emit accSetNewName(e.target.value) } }
  122. }
  123. }
  124. p { id = "message" class = "message" message }
  125. button { id = "next" type = "button" class = "primary" "Next" on click(e) { emit accNext(e) } }
  126. button { id = "cancelgive" type = "button" class = "quiet" "Cancel" on click(e) { emit accCancel(e) } }
  127. }
  128. }
  129. if (isWhere) {
  130. section { id = "wheresection"
  131. stepLabel { "STEP 2 OF 3" }
  132. h1 { "Where can " keyWho " act?" }
  133. ul { id = "ticklist"
  134. li { class = "all"
  135. label { class = "tick"
  136. input { id = "allapps" type = "checkbox" checked = allOn on change(e) { emit accToggleAll(e.target.checked) } }
  137. tickMain { tickName { "All my apps (" + apps.length + ")" } tickSub { "today’s apps; new apps ask again" } }
  138. }
  139. }
  140. for (t of tickRows) {
  141. li { class = "app"
  142. label { class = "tick"
  143. input { class = "apptick" type = "checkbox" name = "app" value = t.id checked = t.on on change(e) { emit accToggleApp(e.target.value) } }
  144. tickMain { tickName { t.name } }
  145. }
  146. }
  147. }
  148. }
  149. h2 { "Level" }
  150. levelRow {
  151. button { type = "button" id = "levelwrite" class = writeCls "Read + write" on click(e) { emit accLevel('write') } }
  152. button { type = "button" id = "levelread" class = readCls "Read only" on click(e) { emit accLevel('read') } }
  153. }
  154. if (newKeyNeeded) {
  155. h2 { "Key label" }
  156. input { id = "keylabel" name = "keylabel" maxlength = "60" autocomplete = "off" value = label on input(e) { emit accSetLabel(e.target.value) } }
  157. }
  158. if (hasKey) { p { class = "lead" keyWho " already has a key: it works in the new apps too, nothing new to copy." } }
  159. p { class = "lead" "In each app " keyWho " can still only do what its project roles allow." }
  160. p { id = "message" class = "message" message }
  161. button { id = "givego" type = "button" class = "primary" "Give access" on click(e) { emit accGive(e) } }
  162. button { id = "backwho" type = "button" class = "quiet" "Back" on click(e) { emit accBackToWho(e) } }
  163. }
  164. }
  165. if (isKey) {
  166. section { id = "keysection"
  167. if (hasKeyText) {
  168. stepLabel { "STEP 3 OF 3 · SHOWN ONCE" }
  169. h1 { keyWho "’s key" }
  170. keyBox { id = "thekey" keyText }
  171. button { id = "copykey" type = "button" class = "primary" "Copy key" on click(e) { emit accCopyKey(e) } }
  172. button { id = "copyenv" type = "button" "Copy as .env line" on click(e) { emit accCopyEnv(e) } }
  173. warnBox { "ident keeps only a hash. Once you leave this screen the key cannot be shown again — rotate to get a new one." }
  174. h2 { "Works in" }
  175. chips { for (n of keyApps) { chip { n } } }
  176. h2 { "The conductor uses it as" }
  177. pre { "Authorization: Bearer idt_…\ngit clone https://x:idt_…@gitoria…" }
  178. }
  179. if (noKeyText) {
  180. h1 { doneText }
  181. }
  182. p { id = "notice" class = "notice" notice }
  183. button { id = "keydone" type = "button" class = "primary" doneLabel on click(e) { emit accDone(e) } }
  184. }
  185. }
  186. if (sheetOpen) {
  187. cellSheet { id = "cellsheet"
  188. h2 { id = "sheettitle" sheet.who " in " sheet.appName }
  189. if (sheet.hasGrant) {
  190. sheetRow { sheetLabel { "Since" } sheetValue { id = "sheetsince" sheet.since } }
  191. sheetRow { sheetLabel { "Last use" } sheetValue { id = "sheetlast" sheet.last } }
  192. sheetRow { sheetLabel { "Level" } sheetValue { id = "sheetlevel" sheet.level }
  193. button { type = "button" id = "changelevel" class = "quiet small" "change" on click(e) { emit accChangeLevel(e) } } }
  194. button { type = "button" id = "rotate" class = "quiet" "Rotate key" on click(e) { emit accRotate(e) } }
  195. button { type = "button" id = "revoke" class = "quiet danger" "Revoke access to " sheet.appName on click(e) { emit accRevoke(e) } }
  196. }
  197. if (sheet.noGrant) {
  198. if (sheet.login) { p { class = "lead" sheet.who " logs in to " sheet.appName " as a person. No key is involved." } }
  199. if (sheet.noLogin) { p { class = "lead" sheet.who " has no access to " sheet.appName "." } }
  200. button { type = "button" id = "giveone" class = "primary" "Give " sheet.who " access to " sheet.appName on click(e) { emit accGiveOne(e) } }
  201. }
  202. p { id = "sheetmessage" class = "message" message }
  203. button { type = "button" id = "closesheet" class = "quiet" "Close" on click(e) { emit accCloseSheet(e) } }
  204. }
  205. }
  206. }
  207. }
  208. }
  209. // the page's own look: nested rules named after its elements; colours only through the theme's tokens
  210. Style {
  211. accessMatrix { display = 'block' overflowX = 'auto'
  212. table { width = '100%' borderCollapse = 'separate' borderSpacing = '0 .4rem'
  213. th { padding = '.3rem .2rem' fontWeight = '400' textAlign = 'center' fontSize = '.875rem' color = 'var(--color-text-muted)' background = 'transparent' }
  214. tbody { th { padding = '.5rem .8rem' textAlign = 'left' fontWeight = '700' background = 'var(--color-surface)' borderRadius = 'var(--radius-large) 0 0 var(--radius-large)' a { color = 'var(--color-text-strong)' } }
  215. td { background = 'var(--color-surface)' lastChild { borderRadius = '0 var(--radius-large) var(--radius-large) 0' }
  216. button { width = '100%' minWidth = 'var(--layout-tap)' minHeight = '3rem' padding = '0' fontSize = '1.1rem' } }
  217. }
  218. td { padding = '0' textAlign = 'center' background = 'var(--color-surface)' }
  219. }
  220. }
  221. // THE STATE OF A CELL is a class the data chooses ('cell key' | 'cell login' | 'cell none'): quoted selectors, nothing else can say it
  222. 'td button.key' { color = 'var(--color-success)' }
  223. 'td button.login' { color = 'var(--color-action)' }
  224. 'td button.none' { color = 'var(--color-text-muted)' }
  225. accessPage { display = 'grid' gap = '1rem' maxWidth = '46rem' margin = '0 auto'
  226. h1 { margin = '0' }
  227. h2 { margin = '.6rem 0 0' }
  228. p { margin = '0' }
  229. section { display = 'grid' gap = '.8rem' position = 'relative' }
  230. ul { listStyle = 'none' margin = '0' padding = '0' display = 'grid' gap = '.5rem'
  231. li { display = 'flex' alignItems = 'center' justifyContent = 'space-between' gap = '.5rem' margin = '0' padding = '.4rem .8rem' background = 'var(--color-surface)' borderRadius = 'var(--radius-large)'
  232. button { minHeight = 'var(--layout-tap)' }
  233. }
  234. }
  235. label { display = 'flex' alignItems = 'center' gap = '.8rem' minHeight = 'var(--layout-tap)' width = '100%' margin = '0' }
  236. input { flex = 'none' }
  237. }
  238. // from 60rem the main button sits at the top right, beside the title (the 1280 mockup); on the phone it is the last thing on the page
  239. @media { minWidth = '60rem' accessPage { '#give' { position = 'absolute' top = '0' right = '0' width = 'auto' } } }
  240. // the pick buttons of step 1 (a class: quoted): the card is the tap area
  241. 'button.pick' { flex = '1 1 auto' display = 'flex' justifyContent = 'flex-start' gap = '.7rem' textAlign = 'left' }
  242. // the chosen identity of step 1 (a class the data chooses) and the dashed "New identity"
  243. 'li.on' { outline = '2px solid var(--color-accent)' outlineOffset = '-2px' }
  244. 'li.newone' { background = 'transparent' outline = '2px dashed var(--color-text-muted)' outlineOffset = '-2px' }
  245. 'li.newone.on' { outline = '2px solid var(--color-accent)' }
  246. // the level buttons: the chosen one is the accent
  247. 'button.seg' { background = 'var(--color-surface)' }
  248. 'button.seg.on' { color = 'var(--color-accent-text)' background = 'var(--color-accent)' }
  249. whoSub { display = 'block' fontSize = '.875rem' fontWeight = '400' color = 'var(--color-text-muted)' }
  250. matrixKey { fontSize = '.875rem' color = 'var(--color-text-muted)' }
  251. stepLabel { fontSize = '.875rem' fontWeight = '700' letterSpacing = '.06em' color = 'var(--color-accent)' }
  252. neverMain { display = 'grid' flex = '1 1 auto' minWidth = '0' }
  253. neverName { fontWeight = '700' color = 'var(--color-text-strong)' }
  254. neverLine { fontSize = '.875rem' color = 'var(--color-text-muted)' }
  255. pickMain { display = 'grid' flex = '1 1 auto' minWidth = '0' textAlign = 'left' }
  256. pickName { fontWeight = '700' color = 'var(--color-text-strong)' }
  257. pickSub { fontSize = '.875rem' fontWeight = '400' color = 'var(--color-text-muted)' }
  258. pickMark { color = 'var(--color-success)' }
  259. avatarDot { display = 'inline-flex' alignItems = 'center' justifyContent = 'center' flex = '0 0 auto' width = '2.25rem' height = '2.25rem' borderRadius = '50%' fontWeight = '700' color = 'var(--color-accent-text)' background = 'var(--color-accent)' }
  260. tickMain { display = 'grid' }
  261. tickName { fontWeight = '600' color = 'var(--color-text-strong)' }
  262. tickSub { fontSize = '.875rem' color = 'var(--color-text-muted)' }
  263. levelRow { display = 'grid' gridTemplateColumns = '1fr 1fr' gap = '.5rem' }
  264. keyBox { display = 'block' padding = '.7rem .8rem' fontFamily = 'ui-monospace, monospace' fontSize = '.875rem' color = 'var(--color-text-strong)' background = 'var(--color-background-sunken)' borderRadius = 'var(--radius-small)' overflowWrap = 'anywhere' userSelect = 'all' }
  265. warnBox { display = 'block' padding = '.7rem .8rem' color = 'var(--color-warning)' background = 'var(--color-surface)' borderRadius = 'var(--radius-small)' }
  266. chips { display = 'flex' flexWrap = 'wrap' gap = '.4rem' }
  267. chip { padding = '.2rem .6rem' fontSize = '.875rem' color = 'var(--color-success)' background = 'var(--color-background-sunken)' borderRadius = 'var(--radius-small)' }
  268. cellSheet { position = 'fixed' left = '0' right = '0' bottom = '0' zIndex = '30' display = 'grid' gap = '.5rem' maxWidth = '34rem' margin = '0 auto' padding = '1rem var(--layout-gutter) 1.2rem' background = 'var(--color-surface)' borderRadius = 'var(--radius-large) var(--radius-large) 0 0' boxShadow = '0 -.5rem 2rem var(--color-background-sunken)' }
  269. sheetRow { display = 'flex' alignItems = 'center' justifyContent = 'space-between' gap = '.5rem' padding = '.5rem .8rem' background = 'var(--color-background-sunken)' borderRadius = 'var(--radius-small)' }
  270. sheetLabel { display = 'block' fontWeight = '700' color = 'var(--color-text-strong)' }
  271. sheetValue { display = 'block' fontSize = '.875rem' color = 'var(--color-text-muted)' }
  272. }
  273. // ---- the screens ------------------------------------------------------------------------------------------------
  274. setScreen = (name) => {
  275. screen = name
  276. isOverview = name == 'overview'
  277. isWho = name == 'who'
  278. isWhere = name == 'where'
  279. isKey = name == 'key'
  280. message = ''
  281. return null
  282. }
  283. setData = (d) => {
  284. data = d
  285. apps = d.apps
  286. rows = d.rows
  287. never = d.never
  288. hasNever = d.hasNever
  289. noApps = d.apps.length == 0
  290. hasApps = d.apps.length > 0
  291. return null
  292. }
  293. pickView = () => {
  294. out = []
  295. for (p of pickRows) { out.push(p) }
  296. return out
  297. }
  298. // the step-1 list with the chosen one marked
  299. markPicks = (list) => {
  300. out = []
  301. for (p of list) {
  302. let chosen = !newMode && '' + p.id == '' + pickId
  303. out.push({ id = p.id label = p.label sub = p.sub initial = p.initial isAgent = p.isAgent dot = p.isAgent ? 'agent' : 'person' hasKey = p.hasKey cls = chosen ? 'on' : '' mark = chosen ? '✓' : '' })
  304. }
  305. return out
  306. }
  307. // step 2's list: each app with its tick
  308. tickView = (ids) => {
  309. out = []
  310. for (a of apps) { out.push({ id = a.id name = a.name on = ids.includes(a.id) }) }
  311. return out
  312. }
  313. tickedIds = () => {
  314. out = []
  315. for (t of tickRows) { if (t.on) { out.push(t.id) } }
  316. return out
  317. }
  318. on accStartGive(e) {
  319. notice = ''
  320. pickId = ''
  321. newMode = false
  322. newCls = 'newone'
  323. newName = ''
  324. r = emit server accPickList()
  325. if (r == null) { message = 'the server did not answer — try again' return null }
  326. pickRaw = r
  327. pickRows = markPicks(r)
  328. setScreen('who')
  329. }
  330. pickRaw = []
  331. on accPick(id) {
  332. newMode = false
  333. newCls = 'newone'
  334. pickId = '' + id
  335. pickRows = markPicks(pickRaw)
  336. message = ''
  337. }
  338. on accPickNew(e) {
  339. newMode = true
  340. newCls = 'newone on'
  341. pickId = ''
  342. pickRows = markPicks(pickRaw)
  343. message = ''
  344. }
  345. on accSetNewName(v) { newName = v }
  346. on accCancel(e) { setScreen('overview') }
  347. // step 1 → 2: who is chosen (or a name typed)
  348. on accNext(e) {
  349. if (newMode) {
  350. if (newName.trim() == '') { message = 'type a name for the new identity' return null }
  351. keyWho = newName.trim()
  352. hasKey = false
  353. newKeyNeeded = true
  354. label = keyWho
  355. } else {
  356. let who = null
  357. for (p of pickRaw) { if ('' + p.id == pickId) { who = p } }
  358. if (who == null) { message = 'pick an identity' return null }
  359. keyWho = who.label
  360. hasKey = who.hasKey
  361. newKeyNeeded = !who.hasKey
  362. label = who.label
  363. }
  364. ids = []
  365. for (a of apps) { ids.push(a.id) }
  366. tickRows = tickView(ids)
  367. allOn = true
  368. level = 'write'
  369. writeCls = 'seg on'
  370. readCls = 'seg'
  371. setScreen('where')
  372. }
  373. on accBackToWho(e) { setScreen('who') }
  374. on accToggleAll(ticked) {
  375. ids = []
  376. if (ticked) { for (a of apps) { ids.push(a.id) } }
  377. tickRows = tickView(ids)
  378. allOn = ticked
  379. }
  380. on accToggleApp(id) {
  381. ids = tickedIds()
  382. next = []
  383. let had = false
  384. for (x of ids) { if ('' + x == '' + id) { had = true } else { next.push(x) } }
  385. if (!had) { next.push('' + id) }
  386. tickRows = tickView(next)
  387. allOn = next.length == apps.length
  388. }
  389. on accLevel(v) {
  390. level = v
  391. writeCls = v == 'write' ? 'seg on' : 'seg'
  392. readCls = v == 'read' ? 'seg on' : 'seg'
  393. }
  394. on accSetLabel(v) { label = v }
  395. // step 2 → 3: give access; the key (when a new one was made) is on the screen and nowhere else
  396. on accGive(e) {
  397. ids = tickedIds()
  398. if (ids.length == 0) { message = 'tick at least one app' return null }
  399. input = { apps = ids level = level label = label }
  400. if (newMode) { input.newName = newName } else { input.identity = pickId }
  401. r = emit server accGiveAccess(input)
  402. if (r == null) { message = 'the server did not answer — try again' return null }
  403. if (r.error != null) { message = r.error return null }
  404. setData(r.data)
  405. showKey(r)
  406. }
  407. showKey = (r) => {
  408. keyWho = r.who
  409. keyApps = r.apps
  410. keyText = r.key == null ? '' : r.key
  411. hasKeyText = r.key != null
  412. noKeyText = r.key == null
  413. doneText = r.key == null ? r.who + ' now has access to ' + r.apps.join(', ') + '.' : ''
  414. doneLabel = r.key == null ? 'Done' : 'I saved it — done'
  415. sheetOpen = false
  416. setScreen('key')
  417. return null
  418. }
  419. on accCopyKey(e) {
  420. window.navigator.clipboard.writeText(keyText)
  421. notice = 'Key copied.'
  422. }
  423. on accCopyEnv(e) {
  424. window.navigator.clipboard.writeText('WORLDAPI_TOKEN=' + keyText)
  425. notice = '.env line copied.'
  426. }
  427. // done: the key is gone from the page
  428. on accDone(e) {
  429. keyText = ''
  430. hasKeyText = false
  431. noKeyText = true
  432. keyWho = ''
  433. keyApps = []
  434. notice = ''
  435. setScreen('overview')
  436. }
  437. // ---- a cell's sheet ---------------------------------------------------------------------------------------------
  438. on accOpenCell(v) {
  439. parts = ('' + v).split(':')
  440. r = emit server accCell(parts[0], parts[1])
  441. if (r == null || r.error != null) { return null }
  442. sheet = r
  443. message = ''
  444. sheetOpen = true
  445. }
  446. on accCloseSheet(e) {
  447. sheetOpen = false
  448. message = ''
  449. }
  450. on accChangeLevel(e) {
  451. next = sheet.levelRaw == 'write' ? 'read' : 'write'
  452. r = emit server accSetLevel(sheet.identity, sheet.app, next)
  453. if (r == null || r.error != null) { message = r == null ? 'the server did not answer — try again' : r.error return null }
  454. setData(r.data)
  455. sheet = r.cell
  456. }
  457. on accRevoke(e) {
  458. if (!confirm('Revoke ' + sheet.who + '’s access to ' + sheet.appName + '? It stops working there within 30 seconds.')) { return null }
  459. r = emit server accRevokeCell(sheet.identity, sheet.app)
  460. if (r == null || r.error != null) { message = r == null ? 'the server did not answer — try again' : r.error return null }
  461. setData(r.data)
  462. sheetOpen = false
  463. }
  464. on accRevokeNever(v) {
  465. parts = ('' + v).split(':')
  466. r = emit server accRevokeCell(parts[0], parts[1])
  467. if (r == null || r.error != null) { return null }
  468. setData(r.data)
  469. }
  470. on accRotate(e) {
  471. if (!confirm('Rotate the key of ' + sheet.who + '? The old key stops working at once, in every app.')) { return null }
  472. r = emit server accRotateKey(sheet.identity)
  473. if (r == null || r.error != null) { message = r == null ? 'the server did not answer — try again' : r.error return null }
  474. showKey(r)
  475. }
  476. // a ○ or ◐ cell: give that identity access to that app (step 2, prefilled)
  477. on accGiveOne(e) {
  478. r = emit server accPickList()
  479. if (r == null) { return null }
  480. pickRaw = r
  481. pickId = sheet.identity
  482. newMode = false
  483. keyWho = sheet.who
  484. hasKey = false
  485. newKeyNeeded = true
  486. for (p of r) { if ('' + p.id == pickId) { hasKey = p.hasKey newKeyNeeded = !p.hasKey label = p.label } }
  487. tickRows = tickView([sheet.app])
  488. allOn = apps.length == 1
  489. sheetOpen = false
  490. setScreen('where')
  491. }
  492. // ---- the faces ----------------------------------------------------------------------------------------------------
  493. on server accPickList(session) {
  494. let me = accountOfSession(&session)
  495. if (me == null) { return [] }
  496. return pickList(me.id)
  497. }
  498. on server accGiveAccess(input, session) {
  499. let me = accountOfSession(&session)
  500. if (me == null) { return { error = 'you are not signed in' } }
  501. r = giveAccess(me.id, input)
  502. if (r.error != null) { return r }
  503. r.data = matrix(me.id)
  504. return r
  505. }
  506. on server accCell(identity, app, session) {
  507. let me = accountOfSession(&session)
  508. if (me == null) { return { error = 'you are not signed in' } }
  509. c = cellOf(me.id, identity, app)
  510. if (c == null) { return { error = 'no such cell' } }
  511. return c
  512. }
  513. on server accSetLevel(identity, app, lv, session) {
  514. let me = accountOfSession(&session)
  515. if (me == null) { return { error = 'you are not signed in' } }
  516. r = setLevel(me.id, identity, app, lv)
  517. if (r.error != null) { return r }
  518. return { data = matrix(me.id) cell = cellOf(me.id, identity, app) }
  519. }
  520. on server accRevokeCell(identity, app, session) {
  521. let me = accountOfSession(&session)
  522. if (me == null) { return { error = 'you are not signed in' } }
  523. r = revokeAccess(me.id, identity, app)
  524. if (r.error != null) { return r }
  525. return { data = matrix(me.id) }
  526. }
  527. on server accRotateKey(identity, session) {
  528. let me = accountOfSession(&session)
  529. if (me == null) { return { error = 'you are not signed in' } }
  530. return rotateKey(me.id, identity)
  531. }

Branches

Latest commits

  • 6fad3bd2Merge branch 'f3-codestep' into mainIdent
  • 51e387f2|||PR ident#40 the code step is one component (components/codestep.hl) placed by home.hl and embed.hl; its verify face, setCode, browserZone and verify call exist once (#40.2)mre
  • c28bddeeMerge branch 'f2-shell' into mainIdent
  • c3a40ff6|||PR ident#40 one shell for the app and /start (account part off on /start, #40.1); startshell.hl removed; unused signOut faces gone (#40.4)mre
  • 060f3870ident#40.4: use the shell sign-out faces in regression gatesmre
  • 9b94aa6aMerge branch 'f1b-cleanup' into mainIdent
  • edcfce3f|||PR ident#41 ident#43 ident#44 login error page as a component (same status codes and text, pixel-identical), declarations and route wiring cleaned upmre
  • 3ac85995ident#43 ident#44: plain declarations for never-reassigned lets, one envString helper, named route functions and audience rule out of project.hlmre
  • c7eef14aMerge branch 'nv1-navigate' into mainIdent
  • 644f9775|||PR ident#36 navigate() instead of window.location in the shell, start shell and homemre
  • 4ca2f921deploy.sh: tar --hard-dereference so backups hold no hard linksmre
  • 23971fb7ident#49: media queries in the language's @media formmre
  • 73f4f97dident: re-vendor to hybriel day38b (mpackdb store-open fix)mre
  • aa056c03ident: a startup error prints its message before exit 1 (hybriel#247)mre
  • ee37a861ident#G48: gitoria's registration gets the wildcard origin of its repo addresses at load (gate tests/gitoria-origin.mjs)mre
  • dc6d486fident#27: the docs gate expects the new Access entry in the main menumre
  • d277633cident#27: README: identity access and the introspect endpointmre
  • e999b0d3ident#27: the Access tab — one key per identity for all its apps: give access in three steps, the overview matrix, a cell's sheet (since, last use, level, rotate, revoke), the app's check POST /api/introspect, agent identities hidden from the login picker, an inbox icon in the header's icon style (gate: tests/access.mjs)mre
  • 436206fcident#47: deploy.sh runs the sign-in gate on the deploy's own port slot, like the sessionwrites and docs gates (the default 8700 can be taken by another process)mre
  • a4887ea3ident#47: the selector's sign-in frame no longer has a Continue button; the identity row itself is the link (gate tests/signin.mjs fails on the old code)mre