Fixes 1099 page

This commit is contained in:
2023-04-06 19:57:32 -07:00
parent e291c22179
commit 0423b31d02
4 changed files with 13 additions and 5 deletions

View File

@@ -51,4 +51,9 @@
(range))))
(defn can-see-client? [identity client]
(when (not client)
(println "WARNING - permission checking for null client"))
(or (= "admin" (:user/role identity))
((set (map :db/id (:user/clients identity))) (:db/id client))
((set (map :db/id (:user/clients identity))) client)))

View File

@@ -16,5 +16,6 @@
iol-ion.query/localize
iol-ion.query/recent-date
iol-ion.query/excel-date
iol-ion.query/can-see-client?
]
:app-name "iol-cloud"}

View File

@@ -1,7 +1,8 @@
(ns auto-ap.ssr.company.company-1099
(:require
[auto-ap.datomic :refer [conn remove-nils]]
[auto-ap.graphql.utils :refer [can-see-client? is-admin?]]
[auto-ap.graphql.utils :refer [is-admin?]]
[iol-ion.query :refer [can-see-client?]]
[auto-ap.shared-views.company.sidebar :refer [company-side-bar]]
[auto-ap.ssr-routes :as ssr-routes]
[auto-ap.ssr.ui :refer [base-page]]
@@ -20,7 +21,7 @@
(let [clients (->> (dc/q '[:find ?c
:in $ ?user
:where [?c :client/code]
[(auto-ap.graphql.utils/can-see-client? ?user ?c)]]
[(iol-ion.query/can-see-client? ?user ?c)]]
(dc/db conn) user)
(map first)
set)

View File

@@ -1,7 +1,8 @@
(ns auto-ap.ssr.company-dropdown
(:require
[auto-ap.datomic :refer [conn]]
[auto-ap.graphql.utils :refer [assert-can-see-client can-see-client?]]
[auto-ap.graphql.utils :refer [assert-can-see-client]]
[iol-ion.query :refer [can-see-client?]]
[auto-ap.ssr-routes :as ssr-routes]
[auto-ap.ssr.components.navbar-dropdown :refer [navbar-dropdown]]
[auto-ap.ssr.utils :refer [html-response]]
@@ -13,7 +14,7 @@
(let [options (->> (dc/q '[:find ?c ?n
:in $ ?user
:where [?c :client/name ?n]
[(auto-ap.graphql.utils/can-see-client? ?user ?c)]]
[(iol-ion.query/can-see-client? ?user ?c)]]
(dc/db conn)
identity)
(map (fn [[k v]]