Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip #104

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

wip #104

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/com/yetanalytics/lrs_admin_ui/db.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@
(s/def :credential/api-key string?)
(s/def :credential/secret-key string?)

(s/def :credential/id string?)

(s/def :credential/scope string?)
(s/def :credential/scopes (s/every :credential/scope))


(s/def ::credential
(s/keys :req-un [:credential/api-key
:credential/secret-key
:credential/scopes]))
:credential/scopes
:credential/id]))

(s/def ::credentials
(s/every ::credential))
Expand Down
17 changes: 11 additions & 6 deletions src/com/yetanalytics/lrs_admin_ui/handlers.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
enable-admin-delete-actor
admin-language-code
stmt-get-max
custom-language]
custom-language
auth-by-cred-id]
?oidc :oidc
?oidc-local-admin :oidc-enable-local-admin}]]
{:db (cond-> (assoc db
Expand All @@ -107,7 +108,8 @@
::db/pref-lang (keyword admin-language-code)
::db/language (merge-with merge
lang/language
custom-language))
custom-language)
::db/auth-by-cred-id auth-by-cred-id)
(and no-val?
(not-empty no-val-logout-url))
(assoc ::db/no-val-logout-url no-val-logout-url))
Expand Down Expand Up @@ -360,10 +362,13 @@
(re-frame/reg-event-fx
:browser/load-xapi
global-interceptors
(fn [{{server-host ::db/server-host
proxy-path ::db/proxy-path
xapi-prefix ::db/xapi-prefix} :db} [_ {:keys [path params]}]]
(let [xapi-url (httpfn/build-xapi-url
(fn [{{server-host ::db/server-host
proxy-path ::db/proxy-path
xapi-prefix ::db/xapi-prefix
auth-by-cred-id ::db/auth-by-cred-id :as db} :db} [_ {:keys [path params]}]]
(let [params (cond-> params
auth-by-cred-id (assoc :credentialID (get-in db [::db/browser :credential :id])))
xapi-url (httpfn/build-xapi-url
server-host xapi-prefix path params proxy-path)]
{:dispatch [:browser/set-address xapi-url]
:http-xhrio {:method :get
Expand Down
Loading