Skip to content

Instantly share code, notes, and snippets.

View mmulich's full-sized avatar

Michael Mulich mmulich

View GitHub Profile
@mmulich
mmulich / roles.sql
Last active August 29, 2015 14:09
authoring roles and acceptances database tables
create table roles(
id integer unique sequence,
document_id uuid,
role_type role_types, -- e.g. author, illustrator
user_id text, -- username as it appears in accounts
profile json, -- a copy of the user's profile json
has_accepted boolean,
requester text,
assignment_data timestamp with timezone default current_timestamp,
primary key (document_id, role_type, user_id),
@mmulich
mmulich / authoring-acceptance-plan.rst
Last active August 29, 2015 14:07
Plan for implementing role/license acceptance in authoring

Story Workflow

content creation auto acceptance:
  1. UI: 'arthur' creates content
  2. Authoring: object created & auto accepts role/license for 'arthur'
  3. Authoring: communication with publishing to set 'arthur' to accepted
adding a role to content:
  1. UI: 'arthur' adds 'smoo' to the content as both an editor and illustrator
[coyote]
# These queue to runner mappings (<queue_name>:<runner_name>) propulate the
# queues list to run through during runtime.
queue-mappings =
cnx_any_latex_completezip:completezip
[amqp]
host = localhost
port = 5672
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:epub="http://www.idpf.org/2007/ops"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:lrmi="http://lrmi.net/the-specification"
>
<head itemscope="itemscope"
itemtype="http://schema.org/Book"
>
{'contents': [{'contents': [{'contents': [{'id': '[email protected]',
'title': 'Document One'}],
'id': 'subcol',
'title': u'Chapter One'},
{'contents': [{'id': '[email protected]',
'title': 'Document One (revised)'}],
'id': 'subcol',
'title': u'Chapter Two'}],
'id': 'subcol',
'title': u'Part One'},
diff --git a/cnxpublishing/db.py b/cnxpublishing/db.py
index d702f41..eeb1c77 100644
--- a/cnxpublishing/db.py
+++ b/cnxpublishing/db.py
@@ -103,6 +103,17 @@ update pending_documents set license_accepted = 't'
where id = %s""", (document_id,))
+def add_pending_resource(cursor, resource):
+ """Adds a pending resource to the database."""
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html> <!-- This is required in HTML5 -->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:lrmi="http://lrmi.net/the-specification"
>
<!-- For EPUB parsing/validation python should only care about data-* attributes.
Other attributes are for discoverability and compatibility with schema.org . -->
@mmulich
mmulich / pub.rst
Last active January 4, 2016 00:49

License

  • GET license on existing content /publications/{id}/license/{user-id} returns 200 Ok.
  • GET license for content that needs license acceptance /publications/{id}/license/{user-id} returns 400 Bad Request.
  • POST license for content that needs license acceptance /publications/{id}/license/{user-id} accepts license and returns 200 Ok.

Roles

Instructions for People Not Called Ross on Fillet

Important locations

Most everything runs from /opt/beta

/opt/beta - root

# ...
class CheckTests(unittest.TestCase):
# These tests assume a remote (or local) service is communicating with
# this service to verify the token it was given is valid.
def setUp(self):
self.config = testing.setUp()
from sqlalchemy import create_engine
engine = create_engine('sqlite://')