Fork me on GitHub
#datomic
<
2017-02-06
>
podviaznikov03:02:37

I tried to retract entity with

transacted payload [[:db.fn/retractEntity 13194139534407]]
and got
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: :db.error/reset-tx-instant You can set :db/txInstant only on the current transaction.
error. Not really sure what I did wrong. Any tips?

akjetma05:02:38

is that entity id a transaction id?

favila13:02:39

@podviaznikov You are attempting to retract a transaction id, but you are not allowed to alter the :db/txInstant assertion on transaction entities.

podviaznikov17:02:39

favila: that id is entity id. Unless they can be the same. But there is definitely an entity behind the id

favila17:02:02

transactions are entities

favila17:02:29

they are entities in the :db.part/tx partition

donaldball15:02:48

We’re beginning to write web service handlers around datomic, and I’m grappling with the question of where and how to enforce authorization. Do folk tend to e.g. write a predicate fn for a user and an arbitrary datomic transaction, or check authorization for specific mutations?

favila16:02:32

@donaldball I know some people use db filter with user-based predicate to enforce visiblity, but that is belt-and-suspenders

favila16:02:16

you really do need to design specific ops to be safe

favila16:02:27

(at least that is what we discovered)

favila16:02:40

an idea we had was post-validation: run the tx with a db/with, then validate no constraints were violated (data or security), then transact with a conditional to ensure integrity

favila16:02:12

we have not tried it yet at scale though

pesterhazy16:02:50

I've used a list of (prismatic) schemas to validate incoming transactions

pesterhazy16:02:27

it worked well but wasn't fine-grained (all admins can transact all transactions matching any whitelisted schema)

val_waeselynck16:02:05

@donaldball we handle authorization on a per-operation basis.

val_waeselynck16:02:02

(I should add that we don't provide our clients an expressive language à la GraphQL / Datomic Pull)

donaldball16:02:48

We’re anticipating using om.next, but as I understand it, the common path even there is for the client to send the server a named mutation operation with some arguments, so y’all’s advice is well taken. Thanks.

devth16:02:53

we handle authz by sanitizing incoming tx vectors and pull queries. (still WIP)

devth16:02:41

completely agnostic to the datomic schema / model, supports any number of roles, access groups and access rules.

marshall17:02:27

Transactions are entities

marshall17:02:46

Every transaction creates an entity

marshall17:02:00

that is the ‘reified’ transaction itself

marshall17:02:17

at a minimum, it contains the txInstant of that transaction

marshall17:02:35

it can also have other attributes (transaction metadata)

marshall17:02:49

as Francis mentioned, you can’t retract Transactions

favila17:02:21

if (d/part <entity-id>) is 3 (= :db.part/tx), then entity-id is a transaction

favila17:02:34

this is true of the entity id you posted

d._.b17:02:04

The videos from Datomic Conf are not showing on that page

d._.b17:02:27

> Sorry, Because of its privacy settings, this video cannot be played here.

d._.b17:02:11

@marshall bah, it was due to my use of ghostery/privacy badger/adblock

marshall17:02:39

ah. glad you got it figured out

marshall17:02:13

the video content is stored elsewhere from the website

marshall17:02:31

a lot of ad blockers prevent embedded video when it’s not from the same host

d._.b17:02:43

@marshall by any chance do you have links to the videos themselves (non-embedded)

d._.b17:02:50

i was unable to inspect and snag them from the page

marshall17:02:01

i don’t think they’re available for local download

d._.b17:02:18

i was interested in linking to tim's video directly in another slack channel

d._.b17:02:20

but no big deal

marshall17:02:21

yeah, looks like they’re only available on that page ATM

devth22:02:05

you know how a query for a set of entities will return them in form #{[eid1] [eid2]}? can the query be changed so that the result would simply be #{eid1 eid2}?

devth22:02:12

@favila thanks! was only familiar with the ?a . spec