Browse Source

Creation script of mongodb database and user

prieto 8 years ago
parent
commit
dbd8df443a

+ 4
- 2
plugins/webui/templates/admin/list_classes_admin.html View File

@@ -9,11 +9,13 @@
9 9
 <h2>Select a class</h2>
10 10
 <ul>
11 11
 {% for classe in my_classes %}
12
-    {% set abst = '' %}
12
+    {% set abst = ' - Abstract' %}
13 13
     {% if not classe.is_abstract() %}
14 14
     {% set abst = ' - ' ~ classe.get(None)|length %}
15
+    <li> <a href="/{{ root_url }}/admin/class_admin?classname={{ classe.__name__ }}" target="_blank">{{ classe.__name__ }} </a>{{ abst }}</li>
16
+    {% else %}
17
+    <li> {{ classe.__name__ }} {{ abst }}</li>
15 18
     {% endif %}
16
-    <li> <a href="class_admin?classname={{ classe.__name__ }}" target="_blank">{{ classe.__name__ }} </a>{{ abst }}</li>
17 19
     {% endfor %}
18 20
 </ul>
19 21
 <div>

+ 1
- 1
plugins/webui/templates/admin/show_class_admin.html View File

@@ -12,7 +12,7 @@
12 12
     {% set objects = target.get(None) %}
13 13
     <ul>
14 14
     {% for obj in objects %}
15
-        <li><a href="update?classname={{ target.__name__  }}&lodel_id={{ obj.uid() }}" target="_blank">{{ obj.uid() }} </a></li>
15
+        <li><a href="/{{ root_url }}/admin/update?classname={{ target.__name__  }}&lodel_id={{ obj.uid() }}" target="_blank">{{ obj.uid() }} </a></li>
16 16
     {% endfor %}
17 17
     </ul>
18 18
  {% endif %}

+ 2
- 2
plugins/webui/templates/listing/show_class.html View File

@@ -17,7 +17,7 @@
17 17
             {% else %}
18 18
             {% set abst = ' - ' ~ child.get(None)|length %}
19 19
          {% endif %}
20
-     <li><a href="show_class?name={{ child.__name__ }}" target="_blank">{{ child.__name__ }}</a>{{ abst }}</li>
20
+     <li><a href="/{{ root_url }}/show_class?classname={{ child.__name__ }}" target="_blank">{{ child.__name__ }}</a>{{ abst }}</li>
21 21
      {% endfor %}
22 22
      </ul>
23 23
   {% endif %}
@@ -27,7 +27,7 @@
27 27
     {% set objects = my_class.get(None) %}
28 28
     <ul>
29 29
     {% for obj in objects %}
30
-        <li><a href="show_object?classname={{ classname }}&lodel_id={{ obj.uid() }}" target="_blank">{{ obj.uid() }} </a></li>
30
+        <li><a href="/{{ root_url }}/show_object?classname={{ classname }}&lodel_id={{ obj.uid() }}" target="_blank">{{ obj.uid() }} </a></li>
31 31
     {% endfor %}
32 32
     </ul>
33 33
  {% endif %}

+ 41
- 0
progs/create_mongodb.sh View File

@@ -0,0 +1,41 @@
1
+#! /bin/bash
2
+
3
+usage() {
4
+	echo -e "Usage : $0 host database newuser_identifier newuser_pwd (admin_identifier|config_file) [admin_pwd]" 1>&2
5
+    echo -e "config_file has to define ADMIN and ADMINPWD" 1>&2
6
+	exit 1
7
+}
8
+
9
+if [ $# -lt 5 ]
10
+then
11
+	echo "Not enough arguments" 1>&2
12
+	usage
13
+fi
14
+
15
+if [ $# -eq 5 ]
16
+then
17
+    if [ ! -f $5 ]
18
+    then  
19
+	    echo "Not enough arguments or the configation file $5 doesn't exist" 1>&2
20
+        usage
21
+    else
22
+	    . $5
23
+    fi
24
+fi
25
+
26
+if [ $# -eq 6 ]
27
+then
28
+    ADMIN=$5
29
+    ADMINPWD=$6
30
+fi
31
+
32
+host=$1
33
+db=$2
34
+newuser=$3
35
+newuserpwd=$4
36
+
37
+mongo $1/admin -u $ADMIN -p $ADMINPWD <<EOF
38
+db.addUser('$3', '$4')
39
+use $db
40
+quit()
41
+EOF

Loading…
Cancel
Save