Work in progress with users and organizations
This commit is contained in:
@@ -182,7 +182,11 @@ def convert_properties(properties, node_schema):
|
|||||||
properties[prop] = datetime.strptime(prop_val, RFC1123_DATE_FORMAT)
|
properties[prop] = datetime.strptime(prop_val, RFC1123_DATE_FORMAT)
|
||||||
elif prop_type == 'objectid':
|
elif prop_type == 'objectid':
|
||||||
prop_val = properties[prop]
|
prop_val = properties[prop]
|
||||||
|
if prop_val:
|
||||||
properties[prop] = ObjectId(prop_val)
|
properties[prop] = ObjectId(prop_val)
|
||||||
|
else:
|
||||||
|
properties[prop] = None
|
||||||
|
|
||||||
return properties
|
return properties
|
||||||
|
|
||||||
|
|
||||||
|
@@ -247,160 +247,160 @@ def populate_db_test():
|
|||||||
|
|
||||||
def populate_node_types(old_ids={}):
|
def populate_node_types(old_ids={}):
|
||||||
shot_node_type = {
|
shot_node_type = {
|
||||||
"name": "shot",
|
'name': 'shot',
|
||||||
"description": "Shot Node Type, for shots",
|
'description': 'Shot Node Type, for shots',
|
||||||
"dyn_schema": {
|
'dyn_schema': {
|
||||||
"url": {
|
'url': {
|
||||||
"type": "string",
|
'type': 'string',
|
||||||
},
|
},
|
||||||
"cut_in": {
|
'cut_in': {
|
||||||
"type": "integer"
|
'type': 'integer'
|
||||||
},
|
},
|
||||||
"cut_out": {
|
'cut_out': {
|
||||||
"type": "integer"
|
'type': 'integer'
|
||||||
},
|
},
|
||||||
"status": {
|
'status': {
|
||||||
"type": "string",
|
'type': 'string',
|
||||||
"allowed": [
|
'allowed': [
|
||||||
"on_hold",
|
'on_hold',
|
||||||
"todo",
|
'todo',
|
||||||
"in_progress",
|
'in_progress',
|
||||||
"review",
|
'review',
|
||||||
"final"
|
'final'
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"notes": {
|
'notes': {
|
||||||
"type": "string",
|
'type': 'string',
|
||||||
"maxlength": 256,
|
'maxlength': 256,
|
||||||
},
|
},
|
||||||
"shot_group": {
|
'shot_group': {
|
||||||
"type": "string",
|
'type': 'string',
|
||||||
#"data_relation": {
|
#'data_relation': {
|
||||||
# "resource": "nodes",
|
# 'resource': 'nodes',
|
||||||
# "field": "_id",
|
# 'field': '_id',
|
||||||
#},
|
#},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"form_schema": {
|
'form_schema': {
|
||||||
"url": {},
|
'url': {},
|
||||||
"cut_in": {},
|
'cut_in': {},
|
||||||
"cut_out": {},
|
'cut_out': {},
|
||||||
"status": {},
|
'status': {},
|
||||||
"notes": {},
|
'notes': {},
|
||||||
"shot_group": {}
|
'shot_group': {}
|
||||||
},
|
},
|
||||||
"parent": {
|
'parent': {
|
||||||
"node_types": ["scene"]
|
'node_types': ['scene']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
task_node_type = {
|
task_node_type = {
|
||||||
"name": "task",
|
'name': 'task',
|
||||||
"description": "Task Node Type, for tasks",
|
'description': 'Task Node Type, for tasks',
|
||||||
"dyn_schema": {
|
'dyn_schema': {
|
||||||
"status": {
|
'status': {
|
||||||
"type": "string",
|
'type': 'string',
|
||||||
"allowed": [
|
'allowed': [
|
||||||
"todo",
|
'todo',
|
||||||
"in_progress",
|
'in_progress',
|
||||||
"on_hold",
|
'on_hold',
|
||||||
"approved",
|
'approved',
|
||||||
"cbb",
|
'cbb',
|
||||||
"final",
|
'final',
|
||||||
"review"
|
'review'
|
||||||
],
|
],
|
||||||
"required": True,
|
'required': True,
|
||||||
},
|
},
|
||||||
"filepath": {
|
'filepath': {
|
||||||
"type": "string",
|
'type': 'string',
|
||||||
},
|
},
|
||||||
"revision": {
|
'revision': {
|
||||||
"type": "integer",
|
'type': 'integer',
|
||||||
},
|
},
|
||||||
"owners": {
|
'owners': {
|
||||||
"type": "dict",
|
'type': 'dict',
|
||||||
"schema": {
|
'schema': {
|
||||||
"users": {
|
'users': {
|
||||||
"type": "list",
|
'type': 'list',
|
||||||
"schema": {
|
'schema': {
|
||||||
"type": "objectid",
|
'type': 'objectid',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"groups": {
|
'groups': {
|
||||||
"type": "list",
|
'type': 'list',
|
||||||
"schema": {
|
'schema': {
|
||||||
"type": "objectid",
|
'type': 'objectid',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"time": {
|
'time': {
|
||||||
"type": "dict",
|
'type': 'dict',
|
||||||
"schema": {
|
'schema': {
|
||||||
"start": {
|
'start': {
|
||||||
"type": "datetime"
|
'type': 'datetime'
|
||||||
},
|
},
|
||||||
"duration": {
|
'duration': {
|
||||||
"type": "integer"
|
'type': 'integer'
|
||||||
},
|
},
|
||||||
"chunks": {
|
'chunks': {
|
||||||
"type": "list",
|
'type': 'list',
|
||||||
"schema": {
|
'schema': {
|
||||||
"type": "dict",
|
'type': 'dict',
|
||||||
"schema": {
|
'schema': {
|
||||||
"start": {
|
'start': {
|
||||||
"type": "datetime",
|
'type': 'datetime',
|
||||||
},
|
},
|
||||||
"duration": {
|
'duration': {
|
||||||
"type": "integer",
|
'type': 'integer',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"is_conflicting" : {
|
'is_conflicting' : {
|
||||||
"type": "boolean"
|
'type': 'boolean'
|
||||||
},
|
},
|
||||||
"is_processing" : {
|
'is_processing' : {
|
||||||
"type": "boolean"
|
'type': 'boolean'
|
||||||
},
|
},
|
||||||
"is_open" : {
|
'is_open' : {
|
||||||
"type": "boolean"
|
'type': 'boolean'
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
"form_schema": {
|
'form_schema': {
|
||||||
"status": {},
|
'status': {},
|
||||||
"filepath": {},
|
'filepath': {},
|
||||||
"revision": {},
|
'revision': {},
|
||||||
"owners": {
|
'owners': {
|
||||||
"schema": {
|
'schema': {
|
||||||
"users":{
|
'users':{
|
||||||
"items": [('User', 'first_name')],
|
'items': [('User', 'first_name')],
|
||||||
},
|
},
|
||||||
"groups": {}
|
'groups': {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"time": {
|
'time': {
|
||||||
"schema": {
|
'schema': {
|
||||||
"start": {},
|
'start': {},
|
||||||
"duration": {},
|
'duration': {},
|
||||||
"chunks": {
|
'chunks': {
|
||||||
"visible": False,
|
'visible': False,
|
||||||
"schema": {
|
'schema': {
|
||||||
"start": {},
|
'start': {},
|
||||||
"duration": {}
|
'duration': {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"is_conflicting": {},
|
'is_conflicting': {},
|
||||||
"is_open": {},
|
'is_open': {},
|
||||||
"is_processing": {},
|
'is_processing': {},
|
||||||
},
|
},
|
||||||
"parent": {
|
'parent': {
|
||||||
"node_types": ["shot"],
|
'node_types': ['shot'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,6 +465,127 @@ def populate_node_types(old_ids={}):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
project_node_type = {
|
||||||
|
'name': 'project',
|
||||||
|
'parent': {},
|
||||||
|
'description': 'The official project type',
|
||||||
|
'dyn_schema': {
|
||||||
|
'category': {
|
||||||
|
'type': 'string',
|
||||||
|
'allowed': [
|
||||||
|
'film',
|
||||||
|
'assets',
|
||||||
|
'software',
|
||||||
|
'game'
|
||||||
|
],
|
||||||
|
'required': True,
|
||||||
|
},
|
||||||
|
'is_private': {
|
||||||
|
'type': 'boolean'
|
||||||
|
},
|
||||||
|
'url': {
|
||||||
|
'type': 'string'
|
||||||
|
},
|
||||||
|
'organization': {
|
||||||
|
'type': 'objectid',
|
||||||
|
'nullable': True,
|
||||||
|
'data_relation': {
|
||||||
|
'resource': 'organizations',
|
||||||
|
'field': '_id',
|
||||||
|
'embeddable': True
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'owners': {
|
||||||
|
'type': 'dict',
|
||||||
|
'schema': {
|
||||||
|
'users': {
|
||||||
|
'type': 'list',
|
||||||
|
'schema': {
|
||||||
|
'type': 'objectid',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'groups': {
|
||||||
|
'type': 'list',
|
||||||
|
'schema': {
|
||||||
|
'type': 'objectid',
|
||||||
|
'data_relation': {
|
||||||
|
'resource': 'groups',
|
||||||
|
'field': '_id',
|
||||||
|
'embeddable': True
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
# Logo
|
||||||
|
'picture_1': {
|
||||||
|
'type': 'objectid',
|
||||||
|
'nullable': True,
|
||||||
|
'data_relation': {
|
||||||
|
'resource': 'files',
|
||||||
|
'field': '_id',
|
||||||
|
'embeddable': True
|
||||||
|
},
|
||||||
|
},
|
||||||
|
# Header
|
||||||
|
'picture_2': {
|
||||||
|
'type': 'objectid',
|
||||||
|
'nullable': True,
|
||||||
|
'data_relation': {
|
||||||
|
'resource': 'files',
|
||||||
|
'field': '_id',
|
||||||
|
'embeddable': True
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'form_schema': {
|
||||||
|
'is_private': {},
|
||||||
|
# TODO add group parsing
|
||||||
|
'category': {},
|
||||||
|
'url': {},
|
||||||
|
'organization': {},
|
||||||
|
'picture_1': {},
|
||||||
|
'picture_2': {},
|
||||||
|
'owners': {
|
||||||
|
'schema': {
|
||||||
|
'users':{
|
||||||
|
'items': [('User', 'first_name')],
|
||||||
|
},
|
||||||
|
'groups': {
|
||||||
|
'items': [('Group', 'name')],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
group_node_type = {
|
||||||
|
'name': 'group',
|
||||||
|
'description': 'Generic group node type',
|
||||||
|
'dyn_schema': {
|
||||||
|
'url': {
|
||||||
|
'type': 'string',
|
||||||
|
},
|
||||||
|
'status': {
|
||||||
|
'type': 'string',
|
||||||
|
'allowed': [
|
||||||
|
'published',
|
||||||
|
'pending'
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'notes': {
|
||||||
|
'type': 'string',
|
||||||
|
'maxlength': 256,
|
||||||
|
},
|
||||||
|
'parent': {}
|
||||||
|
},
|
||||||
|
'form_schema': {
|
||||||
|
'url': {},
|
||||||
|
'status': {},
|
||||||
|
'notes': {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
from pymongo import MongoClient
|
from pymongo import MongoClient
|
||||||
|
|
||||||
client = MongoClient()
|
client = MongoClient()
|
||||||
@@ -489,13 +610,52 @@ def populate_node_types(old_ids={}):
|
|||||||
# Insert new node_type
|
# Insert new node_type
|
||||||
db.node_types.insert(node_type)
|
db.node_types.insert(node_type)
|
||||||
else:
|
else:
|
||||||
|
print("Making the node")
|
||||||
|
print node_type
|
||||||
post_item('node_types', node_type)
|
post_item('node_types', node_type)
|
||||||
|
|
||||||
upgrade(shot_node_type, old_ids)
|
# upgrade(shot_node_type, old_ids)
|
||||||
upgrade(task_node_type, old_ids)
|
# upgrade(task_node_type, old_ids)
|
||||||
upgrade(scene_node_type, old_ids)
|
# upgrade(scene_node_type, old_ids)
|
||||||
upgrade(act_node_type, old_ids)
|
# upgrade(act_node_type, old_ids)
|
||||||
upgrade(comment_node_type, old_ids)
|
# upgrade(comment_node_type, old_ids)
|
||||||
|
upgrade(project_node_type, old_ids)
|
||||||
|
|
||||||
|
|
||||||
|
@manager.command
|
||||||
|
def migrate_custom():
|
||||||
|
from pymongo import MongoClient
|
||||||
|
|
||||||
|
client = MongoClient()
|
||||||
|
db = client.eve
|
||||||
|
|
||||||
|
group_node_type = {
|
||||||
|
'name': 'group',
|
||||||
|
'description': 'Generic group node type',
|
||||||
|
'dyn_schema': {
|
||||||
|
'url': {
|
||||||
|
'type': 'string',
|
||||||
|
},
|
||||||
|
'status': {
|
||||||
|
'type': 'string',
|
||||||
|
'allowed': [
|
||||||
|
'published',
|
||||||
|
'pending'
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'notes': {
|
||||||
|
'type': 'string',
|
||||||
|
'maxlength': 256,
|
||||||
|
},
|
||||||
|
'parent': {}
|
||||||
|
},
|
||||||
|
'form_schema': {
|
||||||
|
'url': {},
|
||||||
|
'status': {},
|
||||||
|
'notes': {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
db.node_types.insert(group_node_type)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@@ -25,6 +25,12 @@ users_schema = {
|
|||||||
'minlength': 1,
|
'minlength': 1,
|
||||||
'maxlength': 60,
|
'maxlength': 60,
|
||||||
},
|
},
|
||||||
|
'username': {
|
||||||
|
'type': 'string',
|
||||||
|
'minlength': 1,
|
||||||
|
'maxlength': 60,
|
||||||
|
'required': True,
|
||||||
|
},
|
||||||
'email': {
|
'email': {
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
'minlength': 1,
|
'minlength': 1,
|
||||||
@@ -49,6 +55,96 @@ users_schema = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
organizations_schema = {
|
||||||
|
'name': {
|
||||||
|
'type': 'string',
|
||||||
|
'minlength': 1,
|
||||||
|
'maxlength': 128,
|
||||||
|
'required': True
|
||||||
|
},
|
||||||
|
'url': {
|
||||||
|
'type': 'string',
|
||||||
|
'minlength': 1,
|
||||||
|
'maxlength': 128,
|
||||||
|
'required': True
|
||||||
|
},
|
||||||
|
'description': {
|
||||||
|
'type': 'string',
|
||||||
|
'maxlength': 256,
|
||||||
|
},
|
||||||
|
'website': {
|
||||||
|
'type': 'string',
|
||||||
|
'maxlength': 256,
|
||||||
|
},
|
||||||
|
'location': {
|
||||||
|
'type': 'string',
|
||||||
|
'maxlength': 256,
|
||||||
|
},
|
||||||
|
'picture': {
|
||||||
|
'type': 'objectid',
|
||||||
|
'nullable': True,
|
||||||
|
'data_relation': {
|
||||||
|
'resource': 'files',
|
||||||
|
'field': '_id',
|
||||||
|
'embeddable': True
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'users': {
|
||||||
|
'type': 'list',
|
||||||
|
'default': [],
|
||||||
|
'schema': {
|
||||||
|
'type': 'objectid',
|
||||||
|
'data_relation': {
|
||||||
|
'resource': 'users',
|
||||||
|
'field': '_id',
|
||||||
|
'embeddable': True
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'teams': {
|
||||||
|
'type': 'list',
|
||||||
|
'default': [],
|
||||||
|
'schema': {
|
||||||
|
'type': 'dict',
|
||||||
|
'schema': {
|
||||||
|
# Team name
|
||||||
|
'name': {
|
||||||
|
'type': 'string',
|
||||||
|
'minlength': 1,
|
||||||
|
'maxlength': 128,
|
||||||
|
'required': True
|
||||||
|
},
|
||||||
|
# List of user ids for the team
|
||||||
|
'users': {
|
||||||
|
'type': 'list',
|
||||||
|
'default': [],
|
||||||
|
'schema': {
|
||||||
|
'type': 'objectid',
|
||||||
|
'data_relation': {
|
||||||
|
'resource': 'users',
|
||||||
|
'field': '_id',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
# List of groups assigned to the team (this will automatically
|
||||||
|
# update the groups property of each user in the team)
|
||||||
|
'groups': {
|
||||||
|
'type': 'list',
|
||||||
|
'default': [],
|
||||||
|
'schema': {
|
||||||
|
'type': 'objectid',
|
||||||
|
'data_relation': {
|
||||||
|
'resource': 'groups',
|
||||||
|
'field': '_id',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
nodes_schema = {
|
nodes_schema = {
|
||||||
'name': {
|
'name': {
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
@@ -306,6 +402,10 @@ groups = {
|
|||||||
'schema': groups_schema,
|
'schema': groups_schema,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
organizations = {
|
||||||
|
'schema': organizations_schema,
|
||||||
|
}
|
||||||
|
|
||||||
DOMAIN = {
|
DOMAIN = {
|
||||||
'users': users,
|
'users': users,
|
||||||
'nodes': nodes,
|
'nodes': nodes,
|
||||||
@@ -313,7 +413,8 @@ DOMAIN = {
|
|||||||
'tokens': tokens,
|
'tokens': tokens,
|
||||||
'files': files,
|
'files': files,
|
||||||
'binary_files': binary_files,
|
'binary_files': binary_files,
|
||||||
'groups': groups
|
'groups': groups,
|
||||||
|
'organizations': organizations
|
||||||
}
|
}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -321,3 +422,6 @@ try:
|
|||||||
MONGO_DBNAME = 'attract_test'
|
MONGO_DBNAME = 'attract_test'
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
if os.environ.get('MONGO_HOST'):
|
||||||
|
MONGO_HOST = os.environ.get('MONGO_HOST')
|
||||||
|
@@ -1,17 +1,26 @@
|
|||||||
FROM ubuntu:14.04
|
FROM debian
|
||||||
MAINTAINER Eibriel <eibriel@eibriel.com>
|
MAINTAINER Francesco Siddi <francesco@blender.org>
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
mongodb
|
python \
|
||||||
|
python-dev \
|
||||||
#RUN mkdir /data && mkdir /data/db
|
python-pip \
|
||||||
|
git \
|
||||||
|
nano
|
||||||
|
|
||||||
RUN mkdir /data
|
RUN mkdir /data
|
||||||
|
RUN mkdir /data/www
|
||||||
|
RUN mkdir /data/www/attract_server_dev
|
||||||
|
#RUN git clone https://github.com/armadillica/attract.git /data/www/attract
|
||||||
|
|
||||||
VOLUME /data/db
|
RUN pip install virtualenv
|
||||||
|
RUN virtualenv /data/venv
|
||||||
|
#RUN . /data/venv/bin/activate
|
||||||
|
#RUN pip install -r requirements.txt
|
||||||
|
|
||||||
CMD ["mongod", "--smallfiles"]
|
VOLUME /data/www/attract_server_dev
|
||||||
|
|
||||||
EXPOSE 27017
|
EXPOSE 5000
|
||||||
|
|
||||||
#CMD ["python", "/attract/attract/manage.py", "runserver", "-DFOREGROUND"]
|
ENTRYPOINT . /data/venv/bin/activate; \
|
||||||
|
cd /data/www/attract_server_dev; \
|
||||||
|
Reference in New Issue
Block a user