mirror of https://gitee.com/bigwinds/arangodb
removed user manager
This commit is contained in:
parent
7e5aa4490d
commit
e8089d86a7
|
@ -53,6 +53,9 @@ case "$1" in
|
|||
start)
|
||||
echo -n "Starting ARANGO daemon"
|
||||
|
||||
ARANGO_PIDDIR=`dirname $ARANGO_PIDFILE`
|
||||
test -d $ARANGO_PIDDIR || (mkdir $ARANGO_PIDDIR && chown arango $ARANGO_PIDDIR)
|
||||
|
||||
$ARANGO_BIN -c $ARANGO_SYSCONFIG --pid-file "$ARANGO_PIDFILE" --supervisor --uid arango
|
||||
|
||||
# Remember status and be verbose
|
||||
|
|
|
@ -323,6 +323,15 @@ clean-local:
|
|||
|
||||
built-sources: build.h errorfiles $(JAVASCRIPT_HEADER)
|
||||
|
||||
################################################################################
|
||||
### @brief tags file
|
||||
################################################################################
|
||||
|
||||
GTAGS_FILES = $(sort $(abspath $(SOURCES) $(HEADERS)))
|
||||
|
||||
GTAGS:
|
||||
echo $(GTAGS_FILES) | tr " " "\n" | gtags -i -f -
|
||||
|
||||
## -----------------------------------------------------------------------------
|
||||
## --SECTION-- DEPENDENCIES
|
||||
## -----------------------------------------------------------------------------
|
||||
|
|
74
Makefile.in
74
Makefile.in
|
@ -366,10 +366,7 @@ am__lib_libarango_a_SOURCES_DIST = lib/Basics/ConditionLocker.cpp \
|
|||
lib/BasicsC/terminal-utils-ncurses.c \
|
||||
lib/BasicsC/terminal-utils.c lib/BasicsC/threads-posix.c \
|
||||
lib/BasicsC/vector.c lib/BasicsC/voc-errors.c \
|
||||
lib/JsonParser/json-parser.c lib/JsonParserX/InputParser.cpp \
|
||||
lib/JsonParserX/JsonParserX.cpp \
|
||||
lib/JsonParserX/JsonParserXDriver.cpp \
|
||||
lib/JsonParserX/JsonScannerX.cpp lib/Logger/Logger.cpp \
|
||||
lib/JsonParser/json-parser.c lib/Logger/Logger.cpp \
|
||||
lib/Logger/LoggerData.cpp lib/Logger/LoggerInfo.cpp \
|
||||
lib/Logger/LoggerStream.cpp lib/Logger/LoggerTiming.cpp \
|
||||
lib/ProgramOptions/program-options.c \
|
||||
|
@ -439,10 +436,6 @@ am_lib_libarango_a_OBJECTS = lib/Basics/ConditionLocker.$(OBJEXT) \
|
|||
lib/BasicsC/threads-posix.$(OBJEXT) \
|
||||
lib/BasicsC/vector.$(OBJEXT) lib/BasicsC/voc-errors.$(OBJEXT) \
|
||||
lib/JsonParser/json-parser.$(OBJEXT) \
|
||||
lib/JsonParserX/InputParser.$(OBJEXT) \
|
||||
lib/JsonParserX/JsonParserX.$(OBJEXT) \
|
||||
lib/JsonParserX/JsonParserXDriver.$(OBJEXT) \
|
||||
lib/JsonParserX/JsonScannerX.$(OBJEXT) \
|
||||
lib/Logger/Logger.$(OBJEXT) lib/Logger/LoggerData.$(OBJEXT) \
|
||||
lib/Logger/LoggerInfo.$(OBJEXT) \
|
||||
lib/Logger/LoggerStream.$(OBJEXT) \
|
||||
|
@ -538,7 +531,6 @@ am_lib_libarango_fe_a_OBJECTS = \
|
|||
lib/UserManager/ApplicationUserManager.$(OBJEXT) \
|
||||
lib/UserManager/Role.$(OBJEXT) \
|
||||
lib/UserManager/Session.$(OBJEXT) \
|
||||
lib/UserManager/SessionHandler.$(OBJEXT) \
|
||||
lib/UserManager/User.$(OBJEXT) \
|
||||
lib/UserManager/UserHandler.$(OBJEXT) \
|
||||
lib/UserManager/UsersHandler.$(OBJEXT)
|
||||
|
@ -1106,7 +1098,7 @@ FLEX_FILES = lib/JsonParser/json-parser.c \
|
|||
################################################################################
|
||||
### @brief flex++
|
||||
################################################################################
|
||||
FLEXXX_FILES = lib/V8/v8-json.cpp lib/JsonParserX/JsonScannerX.cpp
|
||||
FLEXXX_FILES = lib/V8/v8-json.cpp
|
||||
|
||||
################################################################################
|
||||
### @brief bison files
|
||||
|
@ -1120,11 +1112,7 @@ BISON_FILES = arangod/Ahuacatl/ahuacatl-grammar.c
|
|||
################################################################################
|
||||
### @brief bison++ files
|
||||
################################################################################
|
||||
|
||||
################################################################################
|
||||
### @brief bison++
|
||||
################################################################################
|
||||
BISONXX_FILES = lib/JsonParserX/JsonParserX.cpp
|
||||
BISONXX_FILES =
|
||||
|
||||
################################################################################
|
||||
### @brief protocol buffers files
|
||||
|
@ -1320,10 +1308,7 @@ lib_libarango_a_SOURCES = lib/Basics/ConditionLocker.cpp \
|
|||
lib/BasicsC/terminal-utils-ncurses.c \
|
||||
lib/BasicsC/terminal-utils.c lib/BasicsC/threads-posix.c \
|
||||
lib/BasicsC/vector.c lib/BasicsC/voc-errors.c \
|
||||
lib/JsonParser/json-parser.c lib/JsonParserX/InputParser.cpp \
|
||||
lib/JsonParserX/JsonParserX.cpp \
|
||||
lib/JsonParserX/JsonParserXDriver.cpp \
|
||||
lib/JsonParserX/JsonScannerX.cpp lib/Logger/Logger.cpp \
|
||||
lib/JsonParser/json-parser.c lib/Logger/Logger.cpp \
|
||||
lib/Logger/LoggerData.cpp lib/Logger/LoggerInfo.cpp \
|
||||
lib/Logger/LoggerStream.cpp lib/Logger/LoggerTiming.cpp \
|
||||
lib/ProgramOptions/program-options.c \
|
||||
|
@ -1406,7 +1391,6 @@ lib_libarango_fe_a_SOURCES = \
|
|||
lib/UserManager/ApplicationUserManager.cpp \
|
||||
lib/UserManager/Role.cpp \
|
||||
lib/UserManager/Session.cpp \
|
||||
lib/UserManager/SessionHandler.cpp \
|
||||
lib/UserManager/User.cpp \
|
||||
lib/UserManager/UserHandler.cpp \
|
||||
lib/UserManager/UsersHandler.cpp
|
||||
|
@ -1738,6 +1722,11 @@ UNITTESTS_CLIENT = $(addprefix --javascript.unit-tests ,$(SHELL_CLIENT))
|
|||
################################################################################
|
||||
BITARRAY_COMMON = @top_srcdir@/js/common/tests/shell-bitarray-index.js
|
||||
UNITTESTS_SERVER_BITARRAY = $(addprefix --javascript.unit-tests ,$(BITARRAY_COMMON))
|
||||
|
||||
################################################################################
|
||||
### @brief tags file
|
||||
################################################################################
|
||||
GTAGS_FILES = $(sort $(abspath $(SOURCES) $(HEADERS)))
|
||||
@ENABLE_ALL_IN_ONE_PROTOBUF_TRUE@PROTOBUFDIR = @abs_top_srcdir@/3rdParty/protobuf-2.4.1/BUILD
|
||||
@ENABLE_ZEROMQ_TRUE@ZMQDIR = @abs_top_srcdir@/3rdParty/zeromq-2.2.0/BUILD
|
||||
all: $(BUILT_SOURCES)
|
||||
|
@ -1925,24 +1914,6 @@ lib/JsonParser/$(DEPDIR)/$(am__dirstamp):
|
|||
@: > lib/JsonParser/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/JsonParser/json-parser.$(OBJEXT): lib/JsonParser/$(am__dirstamp) \
|
||||
lib/JsonParser/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/JsonParserX/$(am__dirstamp):
|
||||
@$(MKDIR_P) lib/JsonParserX
|
||||
@: > lib/JsonParserX/$(am__dirstamp)
|
||||
lib/JsonParserX/$(DEPDIR)/$(am__dirstamp):
|
||||
@$(MKDIR_P) lib/JsonParserX/$(DEPDIR)
|
||||
@: > lib/JsonParserX/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/JsonParserX/InputParser.$(OBJEXT): \
|
||||
lib/JsonParserX/$(am__dirstamp) \
|
||||
lib/JsonParserX/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/JsonParserX/JsonParserX.$(OBJEXT): \
|
||||
lib/JsonParserX/$(am__dirstamp) \
|
||||
lib/JsonParserX/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/JsonParserX/JsonParserXDriver.$(OBJEXT): \
|
||||
lib/JsonParserX/$(am__dirstamp) \
|
||||
lib/JsonParserX/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/JsonParserX/JsonScannerX.$(OBJEXT): \
|
||||
lib/JsonParserX/$(am__dirstamp) \
|
||||
lib/JsonParserX/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/Logger/$(am__dirstamp):
|
||||
@$(MKDIR_P) lib/Logger
|
||||
@: > lib/Logger/$(am__dirstamp)
|
||||
|
@ -2279,9 +2250,6 @@ lib/UserManager/Role.$(OBJEXT): lib/UserManager/$(am__dirstamp) \
|
|||
lib/UserManager/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/UserManager/Session.$(OBJEXT): lib/UserManager/$(am__dirstamp) \
|
||||
lib/UserManager/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/UserManager/SessionHandler.$(OBJEXT): \
|
||||
lib/UserManager/$(am__dirstamp) \
|
||||
lib/UserManager/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/UserManager/User.$(OBJEXT): lib/UserManager/$(am__dirstamp) \
|
||||
lib/UserManager/$(DEPDIR)/$(am__dirstamp)
|
||||
lib/UserManager/UserHandler.$(OBJEXT): \
|
||||
|
@ -3031,10 +2999,6 @@ mostlyclean-compile:
|
|||
-rm -f lib/HttpServer/RedirectHandler.$(OBJEXT)
|
||||
-rm -f lib/HttpServer/ServiceUnavailableHandler.$(OBJEXT)
|
||||
-rm -f lib/JsonParser/json-parser.$(OBJEXT)
|
||||
-rm -f lib/JsonParserX/InputParser.$(OBJEXT)
|
||||
-rm -f lib/JsonParserX/JsonParserX.$(OBJEXT)
|
||||
-rm -f lib/JsonParserX/JsonParserXDriver.$(OBJEXT)
|
||||
-rm -f lib/JsonParserX/JsonScannerX.$(OBJEXT)
|
||||
-rm -f lib/Logger/Logger.$(OBJEXT)
|
||||
-rm -f lib/Logger/LoggerData.$(OBJEXT)
|
||||
-rm -f lib/Logger/LoggerInfo.$(OBJEXT)
|
||||
|
@ -3090,7 +3054,6 @@ mostlyclean-compile:
|
|||
-rm -f lib/UserManager/ApplicationUserManager.$(OBJEXT)
|
||||
-rm -f lib/UserManager/Role.$(OBJEXT)
|
||||
-rm -f lib/UserManager/Session.$(OBJEXT)
|
||||
-rm -f lib/UserManager/SessionHandler.$(OBJEXT)
|
||||
-rm -f lib/UserManager/User.$(OBJEXT)
|
||||
-rm -f lib/UserManager/UserHandler.$(OBJEXT)
|
||||
-rm -f lib/UserManager/UsersHandler.$(OBJEXT)
|
||||
|
@ -3296,10 +3259,6 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@lib/HttpServer/$(DEPDIR)/RedirectHandler.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/HttpServer/$(DEPDIR)/ServiceUnavailableHandler.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/JsonParser/$(DEPDIR)/json-parser.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/JsonParserX/$(DEPDIR)/InputParser.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/JsonParserX/$(DEPDIR)/JsonParserX.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/JsonParserX/$(DEPDIR)/JsonParserXDriver.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/JsonParserX/$(DEPDIR)/JsonScannerX.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/Logger/$(DEPDIR)/Logger.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/Logger/$(DEPDIR)/LoggerData.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/Logger/$(DEPDIR)/LoggerInfo.Po@am__quote@
|
||||
|
@ -3355,7 +3314,6 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@lib/UserManager/$(DEPDIR)/ApplicationUserManager.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/UserManager/$(DEPDIR)/Role.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/UserManager/$(DEPDIR)/Session.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/UserManager/$(DEPDIR)/SessionHandler.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/UserManager/$(DEPDIR)/User.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/UserManager/$(DEPDIR)/UserHandler.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@lib/UserManager/$(DEPDIR)/UsersHandler.Po@am__quote@
|
||||
|
@ -4969,11 +4927,6 @@ CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||
$$unique
|
||||
|
||||
GTAGS:
|
||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||
&& $(am__cd) $(top_srcdir) \
|
||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||
|
||||
distclean-tags:
|
||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||
|
||||
|
@ -5227,8 +5180,6 @@ distclean-generic:
|
|||
-rm -f lib/HttpServer/$(am__dirstamp)
|
||||
-rm -f lib/JsonParser/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f lib/JsonParser/$(am__dirstamp)
|
||||
-rm -f lib/JsonParserX/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f lib/JsonParserX/$(am__dirstamp)
|
||||
-rm -f lib/Logger/$(DEPDIR)/$(am__dirstamp)
|
||||
-rm -f lib/Logger/$(am__dirstamp)
|
||||
-rm -f lib/MRuby/$(DEPDIR)/$(am__dirstamp)
|
||||
|
@ -5272,7 +5223,7 @@ clean-am: clean-binPROGRAMS clean-generic clean-local \
|
|||
|
||||
distclean: distclean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf PerfTests/$(DEPDIR) UnitTests/$(DEPDIR) UnitTests/Cambridge/$(DEPDIR) UnitTests/Jutland/$(DEPDIR) UnitTests/Philadelphia/$(DEPDIR) arangod/Actions/$(DEPDIR) arangod/Ahuacatl/$(DEPDIR) arangod/BitIndexes/$(DEPDIR) arangod/GeoIndex/$(DEPDIR) arangod/HashIndex/$(DEPDIR) arangod/IndexIterators/$(DEPDIR) arangod/IndexOperators/$(DEPDIR) arangod/MRServer/$(DEPDIR) arangod/PriorityQueue/$(DEPDIR) arangod/RestHandler/$(DEPDIR) arangod/RestServer/$(DEPDIR) arangod/SkipLists/$(DEPDIR) arangod/V8Server/$(DEPDIR) arangod/VocBase/$(DEPDIR) arangoirb/MRClient/$(DEPDIR) arangosh/ArangoShell/$(DEPDIR) arangosh/V8Client/$(DEPDIR) lib/Admin/$(DEPDIR) lib/ApplicationServer/$(DEPDIR) lib/Basics/$(DEPDIR) lib/BasicsC/$(DEPDIR) lib/Dispatcher/$(DEPDIR) lib/HttpServer/$(DEPDIR) lib/JsonParser/$(DEPDIR) lib/JsonParserX/$(DEPDIR) lib/Logger/$(DEPDIR) lib/MRuby/$(DEPDIR) lib/ProgramOptions/$(DEPDIR) lib/ProtocolBuffers/$(DEPDIR) lib/Rest/$(DEPDIR) lib/ResultGenerator/$(DEPDIR) lib/Scheduler/$(DEPDIR) lib/ShapedJson/$(DEPDIR) lib/SimpleHttpClient/$(DEPDIR) lib/Statistics/$(DEPDIR) lib/UserManager/$(DEPDIR) lib/Utilities/$(DEPDIR) lib/V8/$(DEPDIR) lib/Variant/$(DEPDIR) lib/ZeroMQ/$(DEPDIR)
|
||||
-rm -rf PerfTests/$(DEPDIR) UnitTests/$(DEPDIR) UnitTests/Cambridge/$(DEPDIR) UnitTests/Jutland/$(DEPDIR) UnitTests/Philadelphia/$(DEPDIR) arangod/Actions/$(DEPDIR) arangod/Ahuacatl/$(DEPDIR) arangod/BitIndexes/$(DEPDIR) arangod/GeoIndex/$(DEPDIR) arangod/HashIndex/$(DEPDIR) arangod/IndexIterators/$(DEPDIR) arangod/IndexOperators/$(DEPDIR) arangod/MRServer/$(DEPDIR) arangod/PriorityQueue/$(DEPDIR) arangod/RestHandler/$(DEPDIR) arangod/RestServer/$(DEPDIR) arangod/SkipLists/$(DEPDIR) arangod/V8Server/$(DEPDIR) arangod/VocBase/$(DEPDIR) arangoirb/MRClient/$(DEPDIR) arangosh/ArangoShell/$(DEPDIR) arangosh/V8Client/$(DEPDIR) lib/Admin/$(DEPDIR) lib/ApplicationServer/$(DEPDIR) lib/Basics/$(DEPDIR) lib/BasicsC/$(DEPDIR) lib/Dispatcher/$(DEPDIR) lib/HttpServer/$(DEPDIR) lib/JsonParser/$(DEPDIR) lib/Logger/$(DEPDIR) lib/MRuby/$(DEPDIR) lib/ProgramOptions/$(DEPDIR) lib/ProtocolBuffers/$(DEPDIR) lib/Rest/$(DEPDIR) lib/ResultGenerator/$(DEPDIR) lib/Scheduler/$(DEPDIR) lib/ShapedJson/$(DEPDIR) lib/SimpleHttpClient/$(DEPDIR) lib/Statistics/$(DEPDIR) lib/UserManager/$(DEPDIR) lib/Utilities/$(DEPDIR) lib/V8/$(DEPDIR) lib/Variant/$(DEPDIR) lib/ZeroMQ/$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-compile distclean-generic \
|
||||
distclean-hdr distclean-tags
|
||||
|
@ -5321,7 +5272,7 @@ installcheck-am:
|
|||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
||||
-rm -rf $(top_srcdir)/autom4te.cache
|
||||
-rm -rf PerfTests/$(DEPDIR) UnitTests/$(DEPDIR) UnitTests/Cambridge/$(DEPDIR) UnitTests/Jutland/$(DEPDIR) UnitTests/Philadelphia/$(DEPDIR) arangod/Actions/$(DEPDIR) arangod/Ahuacatl/$(DEPDIR) arangod/BitIndexes/$(DEPDIR) arangod/GeoIndex/$(DEPDIR) arangod/HashIndex/$(DEPDIR) arangod/IndexIterators/$(DEPDIR) arangod/IndexOperators/$(DEPDIR) arangod/MRServer/$(DEPDIR) arangod/PriorityQueue/$(DEPDIR) arangod/RestHandler/$(DEPDIR) arangod/RestServer/$(DEPDIR) arangod/SkipLists/$(DEPDIR) arangod/V8Server/$(DEPDIR) arangod/VocBase/$(DEPDIR) arangoirb/MRClient/$(DEPDIR) arangosh/ArangoShell/$(DEPDIR) arangosh/V8Client/$(DEPDIR) lib/Admin/$(DEPDIR) lib/ApplicationServer/$(DEPDIR) lib/Basics/$(DEPDIR) lib/BasicsC/$(DEPDIR) lib/Dispatcher/$(DEPDIR) lib/HttpServer/$(DEPDIR) lib/JsonParser/$(DEPDIR) lib/JsonParserX/$(DEPDIR) lib/Logger/$(DEPDIR) lib/MRuby/$(DEPDIR) lib/ProgramOptions/$(DEPDIR) lib/ProtocolBuffers/$(DEPDIR) lib/Rest/$(DEPDIR) lib/ResultGenerator/$(DEPDIR) lib/Scheduler/$(DEPDIR) lib/ShapedJson/$(DEPDIR) lib/SimpleHttpClient/$(DEPDIR) lib/Statistics/$(DEPDIR) lib/UserManager/$(DEPDIR) lib/Utilities/$(DEPDIR) lib/V8/$(DEPDIR) lib/Variant/$(DEPDIR) lib/ZeroMQ/$(DEPDIR)
|
||||
-rm -rf PerfTests/$(DEPDIR) UnitTests/$(DEPDIR) UnitTests/Cambridge/$(DEPDIR) UnitTests/Jutland/$(DEPDIR) UnitTests/Philadelphia/$(DEPDIR) arangod/Actions/$(DEPDIR) arangod/Ahuacatl/$(DEPDIR) arangod/BitIndexes/$(DEPDIR) arangod/GeoIndex/$(DEPDIR) arangod/HashIndex/$(DEPDIR) arangod/IndexIterators/$(DEPDIR) arangod/IndexOperators/$(DEPDIR) arangod/MRServer/$(DEPDIR) arangod/PriorityQueue/$(DEPDIR) arangod/RestHandler/$(DEPDIR) arangod/RestServer/$(DEPDIR) arangod/SkipLists/$(DEPDIR) arangod/V8Server/$(DEPDIR) arangod/VocBase/$(DEPDIR) arangoirb/MRClient/$(DEPDIR) arangosh/ArangoShell/$(DEPDIR) arangosh/V8Client/$(DEPDIR) lib/Admin/$(DEPDIR) lib/ApplicationServer/$(DEPDIR) lib/Basics/$(DEPDIR) lib/BasicsC/$(DEPDIR) lib/Dispatcher/$(DEPDIR) lib/HttpServer/$(DEPDIR) lib/JsonParser/$(DEPDIR) lib/Logger/$(DEPDIR) lib/MRuby/$(DEPDIR) lib/ProgramOptions/$(DEPDIR) lib/ProtocolBuffers/$(DEPDIR) lib/Rest/$(DEPDIR) lib/ResultGenerator/$(DEPDIR) lib/Scheduler/$(DEPDIR) lib/ShapedJson/$(DEPDIR) lib/SimpleHttpClient/$(DEPDIR) lib/Statistics/$(DEPDIR) lib/UserManager/$(DEPDIR) lib/Utilities/$(DEPDIR) lib/V8/$(DEPDIR) lib/Variant/$(DEPDIR) lib/ZeroMQ/$(DEPDIR)
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
|
@ -5709,6 +5660,9 @@ clean-local:
|
|||
|
||||
built-sources: build.h errorfiles $(JAVASCRIPT_HEADER)
|
||||
|
||||
GTAGS:
|
||||
echo $(GTAGS_FILES) | tr " " "\n" | gtags -i -f -
|
||||
|
||||
.PHONY: Doxygen/js Doxygen/js/system Doxygen/js/modules
|
||||
|
||||
Doxygen/.setup-directories:
|
||||
|
|
|
@ -69,7 +69,12 @@
|
|||
/// <ul>
|
||||
/// <li>@ref DbaManualBasicsDurability</li>
|
||||
/// <li>@ref DbaManualBasicsMvcc</li>
|
||||
/// <li>@ref DbaManualBasicsConfig</li>
|
||||
/// <li>@ref DbaManualBasicsConfig
|
||||
/// <ul>
|
||||
/// <li>@ref DbaManualBasicsConfigGlobal</li>
|
||||
/// <li>@ref DbaManualBasicsConfigCollection</li>
|
||||
/// </ul>
|
||||
/// </li>
|
||||
/// </ul>
|
||||
/// </li>
|
||||
/// </ul>
|
||||
|
@ -108,6 +113,22 @@
|
|||
/// @section DbaManualBasicsConfig Configuration
|
||||
////////////////////////////////////////////////
|
||||
///
|
||||
/// @subsection DbaManualBasicsConfigGlobal Global Configuration
|
||||
////////////////////////////////////////////////////////////////
|
||||
///
|
||||
/// There are certain default values, which you can store in the
|
||||
/// configuration file or supply on the command line.
|
||||
///
|
||||
/// @copydetails triagens::arango::ArangoServer::_defaultMaximalSize
|
||||
///
|
||||
/// @copydetails triagens::arango::ArangoServer::_forceSyncShapes
|
||||
///
|
||||
/// @subsection DbaManualBasicsConfigCollection Per Collection Configuration
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
///
|
||||
/// You can configure the durability behavior on a per collection basis.
|
||||
/// Use the ArangoDB shell to change these properties.
|
||||
///
|
||||
/// @copydetails JS_PropertiesVocbaseCol
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@
|
|||
#include "RestHandler/RestEdgeHandler.h"
|
||||
#include "RestHandler/RestImportHandler.h"
|
||||
#include "Scheduler/ApplicationScheduler.h"
|
||||
#include "UserManager/ApplicationUserManager.h"
|
||||
#include "UserManager/Session.h"
|
||||
#include "V8/V8LineEditor.h"
|
||||
#include "V8/v8-conv.h"
|
||||
|
@ -150,7 +149,6 @@ static void DefineApiHandlers (HttpHandlerFactory* factory,
|
|||
|
||||
static void DefineAdminHandlers (HttpHandlerFactory* factory,
|
||||
ApplicationAdminServer* admin,
|
||||
ApplicationUserManager* user,
|
||||
TRI_vocbase_t* vocbase) {
|
||||
|
||||
// add "/version" handler
|
||||
|
@ -158,7 +156,6 @@ static void DefineAdminHandlers (HttpHandlerFactory* factory,
|
|||
|
||||
// add admin handlers
|
||||
admin->addHandlers(factory, "/_admin");
|
||||
user->addHandlers(factory, "/_admin");
|
||||
|
||||
// add statistics
|
||||
factory->addHandler("/_admin/connection-statistics",
|
||||
|
@ -200,7 +197,6 @@ ArangoServer::ArangoServer (int argc, char** argv)
|
|||
_applicationDispatcher(0),
|
||||
_applicationEndpointServer(0),
|
||||
_applicationAdminServer(0),
|
||||
_applicationUserManager(0),
|
||||
_dispatcherThreads(8),
|
||||
_databasePath(),
|
||||
_removeOnDrop(true),
|
||||
|
@ -312,42 +308,6 @@ void ArangoServer::buildApplicationServer () {
|
|||
_applicationAdminServer->allowVersion("arango", TRIAGENS_VERSION);
|
||||
_applicationAdminServer->allowAdminDirectory(); // might be changed later
|
||||
|
||||
// .............................................................................
|
||||
// build the application user manager
|
||||
// .............................................................................
|
||||
|
||||
_applicationUserManager = new ApplicationUserManager();
|
||||
_applicationServer->addFeature(_applicationUserManager);
|
||||
|
||||
// create manager role
|
||||
vector<right_t> rightsManager;
|
||||
rightsManager.push_back(RIGHT_TO_MANAGE_USER);
|
||||
rightsManager.push_back(RIGHT_TO_MANAGE_ADMIN);
|
||||
|
||||
_applicationUserManager->createRole("manager", rightsManager, 0);
|
||||
|
||||
// create admin role
|
||||
vector<right_t> rightsAdmin;
|
||||
rightsAdmin.push_back(RIGHT_TO_MANAGE_USER);
|
||||
rightsAdmin.push_back(RIGHT_TO_BE_DELETED);
|
||||
|
||||
_applicationUserManager->createRole("admin", rightsAdmin, RIGHT_TO_MANAGE_ADMIN);
|
||||
|
||||
// create user role
|
||||
vector<right_t> rightsUser;
|
||||
rightsUser.push_back(RIGHT_TO_BE_DELETED);
|
||||
|
||||
_applicationUserManager->createRole("user", rightsUser, RIGHT_TO_MANAGE_USER);
|
||||
|
||||
// create a standard user
|
||||
_applicationUserManager->createUser("manager", "manager");
|
||||
|
||||
// added a anonymous right for session which are not logged in
|
||||
vector<right_t> rightsAnonymous;
|
||||
rightsAnonymous.push_back(RIGHT_TO_LOGIN);
|
||||
|
||||
_applicationUserManager->setAnonymousRights(rightsAnonymous);
|
||||
|
||||
// .............................................................................
|
||||
// define server options
|
||||
// .............................................................................
|
||||
|
@ -440,8 +400,6 @@ void ArangoServer::buildApplicationServer () {
|
|||
// .............................................................................
|
||||
|
||||
if (! _applicationServer->parse(_argc, _argv, additional)) {
|
||||
ApplicationUserManager::unloadUsers();
|
||||
ApplicationUserManager::unloadRoles();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
@ -456,8 +414,6 @@ void ArangoServer::buildApplicationServer () {
|
|||
if (_defaultMaximalSize < TRI_JOURNAL_MINIMAL_SIZE) {
|
||||
// validate journal size
|
||||
LOGGER_FATAL << "invalid journal size. expected at least " << TRI_JOURNAL_MINIMAL_SIZE;
|
||||
ApplicationUserManager::unloadUsers();
|
||||
ApplicationUserManager::unloadRoles();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
@ -469,9 +425,6 @@ void ArangoServer::buildApplicationServer () {
|
|||
|
||||
if (1 < arguments.size()) {
|
||||
LOGGER_FATAL << "expected at most one database directory, got " << arguments.size();
|
||||
|
||||
ApplicationUserManager::unloadUsers();
|
||||
ApplicationUserManager::unloadRoles();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
else if (1 == arguments.size()) {
|
||||
|
@ -481,9 +434,6 @@ void ArangoServer::buildApplicationServer () {
|
|||
if (_databasePath.empty()) {
|
||||
LOGGER_FATAL << "no database path has been supplied, giving up";
|
||||
LOGGER_INFO << "please use the '--database.directory' option";
|
||||
|
||||
ApplicationUserManager::unloadUsers();
|
||||
ApplicationUserManager::unloadRoles();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
|
|
@ -367,9 +367,9 @@ namespace triagens {
|
|||
///
|
||||
/// @CMDOPT{--database.force-sync-shapes @CA{boolean}}
|
||||
///
|
||||
/// Force synching of shape data to disk when writing shape information.
|
||||
/// If turned off, synching will still happen for shapes of collections that
|
||||
/// have a waitForSync value of @LIT{true}. If turned on, synching of shape data
|
||||
/// Force syncing of shape data to disk when writing shape information.
|
||||
/// If turned off, syncing will still happen for shapes of collections that
|
||||
/// have a waitForSync value of @LIT{true}. If turned on, syncing of shape data
|
||||
/// will always happen, regards of the value of waitForSync.
|
||||
///
|
||||
/// The default is @LIT{true}.
|
||||
|
|
|
@ -300,9 +300,20 @@ static HttpResponse* ExecuteActionVocbase (TRI_vocbase_t* vocbase,
|
|||
// },
|
||||
//
|
||||
// "requestType" : "GET",
|
||||
// "requestBody" : "... only for PUT and POST ..."
|
||||
// "requestBody" : "... only for PUT and POST ...",
|
||||
// "user" : "authenticatedUser"
|
||||
// }
|
||||
|
||||
// create user or null
|
||||
string const& user = request->user();
|
||||
|
||||
if (user.empty()) {
|
||||
req->Set(v8g->UserKey, v8::Null());
|
||||
}
|
||||
else {
|
||||
req->Set(v8g->UserKey, v8::String::New(user.c_str()));
|
||||
}
|
||||
|
||||
// copy suffix
|
||||
v8::Handle<v8::Array> suffixArray = v8::Array::New();
|
||||
vector<string> const& suffix = request->suffix();
|
||||
|
@ -627,6 +638,7 @@ void TRI_InitV8Actions (v8::Handle<v8::Context> context, ApplicationV8* applicat
|
|||
v8g->RequestTypeKey = v8::Persistent<v8::String>::New(v8::String::New("requestType"));
|
||||
v8g->ResponseCodeKey = v8::Persistent<v8::String>::New(v8::String::New("responseCode"));
|
||||
v8g->SuffixKey = v8::Persistent<v8::String>::New(v8::String::New("suffix"));
|
||||
v8g->UserKey = v8::Persistent<v8::String>::New(v8::String::New("user"));
|
||||
|
||||
v8g->DeleteConstant = v8::Persistent<v8::String>::New(v8::String::New("DELETE"));
|
||||
v8g->GetConstant = v8::Persistent<v8::String>::New(v8::String::New("GET"));
|
||||
|
|
|
@ -279,15 +279,18 @@ void TRI_LoadAuthInfo (TRI_vocbase_t* vocbase) {
|
|||
TRI_shaped_json_t shapedJson;
|
||||
|
||||
d = (TRI_doc_mptr_t const*) *ptr;
|
||||
TRI_EXTRACT_SHAPED_JSON_MARKER(shapedJson, d->_data);
|
||||
|
||||
auth = ConvertAuthInfo(vocbase, doc, &shapedJson);
|
||||
if (d->_deletion == 0) {
|
||||
TRI_EXTRACT_SHAPED_JSON_MARKER(shapedJson, d->_data);
|
||||
|
||||
if (auth != NULL) {
|
||||
old = TRI_InsertElementAssociativePointer(&vocbase->_authInfo, auth, true);
|
||||
auth = ConvertAuthInfo(vocbase, doc, &shapedJson);
|
||||
|
||||
if (old != NULL) {
|
||||
FreeAuthInfo(old);
|
||||
if (auth != NULL) {
|
||||
old = TRI_InsertKeyAssociativePointer(&vocbase->_authInfo, auth->_username, auth, true);
|
||||
|
||||
if (old != NULL) {
|
||||
FreeAuthInfo(old);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -344,11 +347,19 @@ bool TRI_CheckAuthenticationAuthInfo (char const* username,
|
|||
char const* password) {
|
||||
TRI_vocbase_auth_t* auth;
|
||||
bool res;
|
||||
char* hex;
|
||||
char* salted;
|
||||
char* sha256;
|
||||
size_t hexLen;
|
||||
size_t len;
|
||||
size_t sha256Len;
|
||||
|
||||
// no authentication info available, always authenticate
|
||||
if (DefaultAuthInfo == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// lockup username
|
||||
TRI_ReadLockReadWriteLock(&DefaultAuthInfo->_authInfoLock);
|
||||
auth = TRI_LookupByKeyAssociativePointer(&DefaultAuthInfo->_authInfo, username);
|
||||
|
||||
|
@ -362,12 +373,51 @@ bool TRI_CheckAuthenticationAuthInfo (char const* username,
|
|||
return false;
|
||||
}
|
||||
|
||||
LOG_DEBUG("found active user '%s', expecting password '%s', got '%s'",
|
||||
username,
|
||||
auth->_password,
|
||||
password);
|
||||
// convert password
|
||||
res = false;
|
||||
|
||||
if (TRI_IsPrefixString(auth->_password, "$1$")) {
|
||||
if (strlen(auth->_password) < 12 || auth->_password[11] != '$') {
|
||||
LOG_WARNING("found corrupted password for user '%s'", username);
|
||||
}
|
||||
else {
|
||||
len = 8 + strlen(password);
|
||||
salted = TRI_Allocate(TRI_CORE_MEM_ZONE, len + 1, false);
|
||||
memcpy(salted, auth->_password + 3, 8);
|
||||
memcpy(salted + 8, password, len - 8);
|
||||
salted[len] = '\0';
|
||||
|
||||
sha256 = TRI_SHA256String(salted, len, &sha256Len);
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, salted);
|
||||
|
||||
hex = TRI_EncodeHexString(sha256, sha256Len, &hexLen);
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, sha256);
|
||||
|
||||
LOG_DEBUG("found active user '%s', expecting password '%s', got '%s'",
|
||||
username,
|
||||
auth->_password + 12,
|
||||
hex);
|
||||
|
||||
res = TRI_EqualString(auth->_password + 12, hex);
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, hex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
len = strlen(password);
|
||||
sha256 = TRI_SHA256String(password, len, &sha256Len);
|
||||
|
||||
hex = TRI_EncodeHexString(sha256, sha256Len, &hexLen);
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, sha256);
|
||||
|
||||
LOG_DEBUG("found active user '%s', expecting password '%s', got '%s'",
|
||||
username,
|
||||
auth->_password + 12,
|
||||
hex);
|
||||
|
||||
res = TRI_EqualString(auth->_password, hex);
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, hex);
|
||||
}
|
||||
|
||||
res = TRI_EqualString(auth->_password, password);
|
||||
TRI_ReadUnlockReadWriteLock(&DefaultAuthInfo->_authInfoLock);
|
||||
|
||||
return res;
|
||||
|
|
|
@ -1821,9 +1821,9 @@ TRI_vocbase_col_t* TRI_UseCollectionByNameVocBase (TRI_vocbase_t* vocbase, char
|
|||
// check that we have an existing name
|
||||
// .............................................................................
|
||||
|
||||
TRI_WRITE_LOCK_COLLECTIONS_VOCBASE(vocbase);
|
||||
TRI_READ_LOCK_COLLECTIONS_VOCBASE(vocbase);
|
||||
collection = TRI_LookupByKeyAssociativePointer(&vocbase->_collectionsByName, name);
|
||||
TRI_WRITE_UNLOCK_COLLECTIONS_VOCBASE(vocbase);
|
||||
TRI_READ_UNLOCK_COLLECTIONS_VOCBASE(vocbase);
|
||||
|
||||
if (collection == NULL) {
|
||||
LOG_DEBUG("unknown collection '%s'", name);
|
||||
|
|
|
@ -530,7 +530,7 @@ void ArangoClient::printWelcomeInfo () {
|
|||
|
||||
void ArangoClient::printByeBye () {
|
||||
if (! _quiet) {
|
||||
cout << endl << "Bye Bye! Auf Wiedersehen! До свидания! さようなら" << endl;
|
||||
cout << endl << "Bye Bye! Auf Wiedersehen! Na shledanou! До свидания! さようなら" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,9 @@
|
|||
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var actions = require("actions");
|
||||
var API = "_api/collection";
|
||||
(function() {
|
||||
var actions = require("actions");
|
||||
var API = "_api/collection";
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private functions
|
||||
|
@ -41,37 +42,37 @@ var API = "_api/collection";
|
|||
/// @brief collection representation
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function CollectionRepresentation (collection, showProperties, showCount, showFigures) {
|
||||
var result = {};
|
||||
function CollectionRepresentation (collection, showProperties, showCount, showFigures) {
|
||||
var result = {};
|
||||
|
||||
result.id = collection._id;
|
||||
result.name = collection.name();
|
||||
result.id = collection._id;
|
||||
result.name = collection.name();
|
||||
|
||||
if (showProperties) {
|
||||
var properties = collection.properties();
|
||||
if (showProperties) {
|
||||
var properties = collection.properties();
|
||||
|
||||
result.waitForSync = properties.waitForSync;
|
||||
result.journalSize = properties.journalSize;
|
||||
}
|
||||
|
||||
if (showCount) {
|
||||
result.count = collection.count();
|
||||
}
|
||||
|
||||
if (showFigures) {
|
||||
var figures = collection.figures();
|
||||
|
||||
if (figures) {
|
||||
result.figures = figures;
|
||||
result.waitForSync = properties.waitForSync;
|
||||
result.journalSize = properties.journalSize;
|
||||
}
|
||||
|
||||
if (showCount) {
|
||||
result.count = collection.count();
|
||||
}
|
||||
|
||||
if (showFigures) {
|
||||
var figures = collection.figures();
|
||||
|
||||
if (figures) {
|
||||
result.figures = figures;
|
||||
}
|
||||
}
|
||||
|
||||
result.status = collection.status();
|
||||
result.type = collection.type();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
result.status = collection.status();
|
||||
result.type = collection.type();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -115,71 +116,71 @@ function CollectionRepresentation (collection, showProperties, showCount, showFi
|
|||
/// @verbinclude api-collection-create-collection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function POST_api_collection (req, res) {
|
||||
var body = actions.getJsonBody(req, res);
|
||||
function POST_api_collection (req, res) {
|
||||
var body = actions.getJsonBody(req, res);
|
||||
|
||||
if (body === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! body.hasOwnProperty("name")) {
|
||||
actions.resultBad(req, res, actions.ERROR_ARANGO_ILLEGAL_NAME,
|
||||
"name must be non-empty");
|
||||
return;
|
||||
}
|
||||
|
||||
var name = body.name;
|
||||
var parameter = { waitForSync : false };
|
||||
var cid = undefined;
|
||||
var type = ArangoCollection.TYPE_DOCUMENT;
|
||||
|
||||
if (body.hasOwnProperty("waitForSync")) {
|
||||
parameter.waitForSync = body.waitForSync;
|
||||
}
|
||||
|
||||
if (body.hasOwnProperty("journalSize")) {
|
||||
parameter.journalSize = body.journalSize;
|
||||
}
|
||||
|
||||
if (body.hasOwnProperty("isSystem")) {
|
||||
parameter.isSystem = body.isSystem;
|
||||
}
|
||||
|
||||
if (body.hasOwnProperty("_id")) {
|
||||
cid = body._id;
|
||||
}
|
||||
|
||||
if (body.hasOwnProperty("type")) {
|
||||
type = body.type;
|
||||
}
|
||||
|
||||
try {
|
||||
var collection;
|
||||
|
||||
if (type == ArangoCollection.TYPE_EDGE) {
|
||||
collection = internal.db._createEdgeCollection(name, parameter, cid);
|
||||
}
|
||||
else {
|
||||
collection = internal.db._createDocumentCollection(name, parameter, cid);
|
||||
if (body === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
var result = {};
|
||||
var headers = {};
|
||||
if (! body.hasOwnProperty("name")) {
|
||||
actions.resultBad(req, res, actions.ERROR_ARANGO_ILLEGAL_NAME,
|
||||
"name must be non-empty");
|
||||
return;
|
||||
}
|
||||
|
||||
result.id = collection._id;
|
||||
result.name = collection.name();
|
||||
result.waitForSync = parameter.waitForSync;
|
||||
result.status = collection.status();
|
||||
result.type = collection.type();
|
||||
var name = body.name;
|
||||
var parameter = { waitForSync : false };
|
||||
var cid = undefined;
|
||||
var type = ArangoCollection.TYPE_DOCUMENT;
|
||||
|
||||
headers.location = "/" + API + "/" + collection._id;
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result, headers);
|
||||
if (body.hasOwnProperty("waitForSync")) {
|
||||
parameter.waitForSync = body.waitForSync;
|
||||
}
|
||||
|
||||
if (body.hasOwnProperty("journalSize")) {
|
||||
parameter.journalSize = body.journalSize;
|
||||
}
|
||||
|
||||
if (body.hasOwnProperty("isSystem")) {
|
||||
parameter.isSystem = body.isSystem;
|
||||
}
|
||||
|
||||
if (body.hasOwnProperty("_id")) {
|
||||
cid = body._id;
|
||||
}
|
||||
|
||||
if (body.hasOwnProperty("type")) {
|
||||
type = body.type;
|
||||
}
|
||||
|
||||
try {
|
||||
var collection;
|
||||
|
||||
if (type == ArangoCollection.TYPE_EDGE) {
|
||||
collection = internal.db._createEdgeCollection(name, parameter, cid);
|
||||
}
|
||||
else {
|
||||
collection = internal.db._createDocumentCollection(name, parameter, cid);
|
||||
}
|
||||
|
||||
var result = {};
|
||||
var headers = {};
|
||||
|
||||
result.id = collection._id;
|
||||
result.name = collection.name();
|
||||
result.waitForSync = parameter.waitForSync;
|
||||
result.status = collection.status();
|
||||
result.type = collection.type();
|
||||
|
||||
headers.location = "/" + API + "/" + collection._id;
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result, headers);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns all collections
|
||||
|
@ -200,24 +201,24 @@ function POST_api_collection (req, res) {
|
|||
/// @verbinclude api-collection-all-collections
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function GET_api_collections (req, res) {
|
||||
var list = [];
|
||||
var names = {};
|
||||
var collections = internal.db._collections();
|
||||
function GET_api_collections (req, res) {
|
||||
var list = [];
|
||||
var names = {};
|
||||
var collections = internal.db._collections();
|
||||
|
||||
for (var i = 0; i < collections.length; ++i) {
|
||||
var collection = collections[i];
|
||||
var rep = CollectionRepresentation(collection);
|
||||
|
||||
list.push(rep);
|
||||
names[rep.name] = rep;
|
||||
for (var i = 0; i < collections.length; ++i) {
|
||||
var collection = collections[i];
|
||||
var rep = CollectionRepresentation(collection);
|
||||
|
||||
list.push(rep);
|
||||
names[rep.name] = rep;
|
||||
}
|
||||
|
||||
var result = { collections : list, names : names };
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
|
||||
var result = { collections : list, names : names };
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns a collection
|
||||
///
|
||||
|
@ -324,93 +325,93 @@ function GET_api_collections (req, res) {
|
|||
/// @verbinclude api-collection-get-collection-figures
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function GET_api_collection (req, res) {
|
||||
|
||||
// .............................................................................
|
||||
// /_api/collection
|
||||
// .............................................................................
|
||||
|
||||
if (req.suffix.length === 0) {
|
||||
GET_api_collections(req, res);
|
||||
return;
|
||||
}
|
||||
|
||||
var name = decodeURIComponent(req.suffix[0]);
|
||||
var id = parseInt(name) || name;
|
||||
var collection = internal.db._collection(id);
|
||||
|
||||
if (collection === null) {
|
||||
actions.collectionNotFound(req, res, name);
|
||||
return;
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
// /_api/collection/<identifier>
|
||||
// .............................................................................
|
||||
|
||||
if (req.suffix.length === 1) {
|
||||
var result = CollectionRepresentation(collection, false, false, false);
|
||||
var headers = { location : "/" + API + "/" + collection._id };
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result, headers);
|
||||
}
|
||||
|
||||
else if (req.suffix.length === 2) {
|
||||
var sub = decodeURIComponent(req.suffix[1]);
|
||||
function GET_api_collection (req, res) {
|
||||
|
||||
// .............................................................................
|
||||
// /_api/collection/<identifier>/figures
|
||||
// /_api/collection
|
||||
// .............................................................................
|
||||
|
||||
if (sub === "figures") {
|
||||
var result = CollectionRepresentation(collection, true, true, true);
|
||||
var headers = { location : "/" + API + "/" + collection._id + "/figures" };
|
||||
if (req.suffix.length === 0) {
|
||||
GET_api_collections(req, res);
|
||||
return;
|
||||
}
|
||||
|
||||
var name = decodeURIComponent(req.suffix[0]);
|
||||
var id = parseInt(name) || name;
|
||||
var collection = internal.db._collection(id);
|
||||
|
||||
if (collection === null) {
|
||||
actions.collectionNotFound(req, res, name);
|
||||
return;
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
// /_api/collection/<identifier>
|
||||
// .............................................................................
|
||||
|
||||
if (req.suffix.length === 1) {
|
||||
var result = CollectionRepresentation(collection, false, false, false);
|
||||
var headers = { location : "/" + API + "/" + collection._id };
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result, headers);
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
// /_api/collection/<identifier>/count
|
||||
// .............................................................................
|
||||
else if (req.suffix.length === 2) {
|
||||
var sub = decodeURIComponent(req.suffix[1]);
|
||||
|
||||
else if (sub === "count") {
|
||||
var result = CollectionRepresentation(collection, true, true, false);
|
||||
var headers = { location : "/" + API + "/" + collection._id + "/count" };
|
||||
// .............................................................................
|
||||
// /_api/collection/<identifier>/figures
|
||||
// .............................................................................
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result, headers);
|
||||
if (sub === "figures") {
|
||||
var result = CollectionRepresentation(collection, true, true, true);
|
||||
var headers = { location : "/" + API + "/" + collection._id + "/figures" };
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result, headers);
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
// /_api/collection/<identifier>/count
|
||||
// .............................................................................
|
||||
|
||||
else if (sub === "count") {
|
||||
var result = CollectionRepresentation(collection, true, true, false);
|
||||
var headers = { location : "/" + API + "/" + collection._id + "/count" };
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result, headers);
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
// /_api/collection/<identifier>/properties
|
||||
// .............................................................................
|
||||
|
||||
else if (sub === "properties") {
|
||||
var result = CollectionRepresentation(collection, true, false, false);
|
||||
var headers = { location : "/" + API + "/" + collection._id + "/properties" };
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result, headers);
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
// /_api/collection/<identifier>/parameter (DEPRECATED)
|
||||
// .............................................................................
|
||||
|
||||
else if (sub === "parameter") {
|
||||
var result = CollectionRepresentation(collection, true, false, false);
|
||||
var headers = { location : "/" + API + "/" + collection._id + "/parameter" };
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result, headers);
|
||||
}
|
||||
|
||||
else {
|
||||
actions.resultNotFound(req, res, "expecting one of the resources 'count', 'figures', 'properties', 'parameter'");
|
||||
}
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
// /_api/collection/<identifier>/properties
|
||||
// .............................................................................
|
||||
|
||||
else if (sub === "properties") {
|
||||
var result = CollectionRepresentation(collection, true, false, false);
|
||||
var headers = { location : "/" + API + "/" + collection._id + "/properties" };
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result, headers);
|
||||
}
|
||||
|
||||
// .............................................................................
|
||||
// /_api/collection/<identifier>/parameter (DEPRECATED)
|
||||
// .............................................................................
|
||||
|
||||
else if (sub === "parameter") {
|
||||
var result = CollectionRepresentation(collection, true, false, false);
|
||||
var headers = { location : "/" + API + "/" + collection._id + "/parameter" };
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result, headers);
|
||||
}
|
||||
|
||||
else {
|
||||
actions.resultNotFound(req, res, "expecting one of the resources 'count', 'figures', 'properties', 'parameter'");
|
||||
actions.resultBad(req, res, actions.ERROR_HTTP_BAD_PARAMETER,
|
||||
"expect GET /" + API + "/<collection-identifer>/<method>");
|
||||
}
|
||||
}
|
||||
else {
|
||||
actions.resultBad(req, res, actions.ERROR_HTTP_BAD_PARAMETER,
|
||||
"expect GET /" + API + "/<collection-identifer>/<method>");
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief loads a collection
|
||||
|
@ -440,18 +441,18 @@ function GET_api_collection (req, res) {
|
|||
/// @verbinclude api-collection-identifier-load
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function PUT_api_collection_load (req, res, collection) {
|
||||
try {
|
||||
collection.load();
|
||||
function PUT_api_collection_load (req, res, collection) {
|
||||
try {
|
||||
collection.load();
|
||||
|
||||
var result = CollectionRepresentation(collection, false, true, false);
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
var result = CollectionRepresentation(collection, false, true, false);
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief unloads a collection
|
||||
|
@ -479,18 +480,18 @@ function PUT_api_collection_load (req, res, collection) {
|
|||
/// @verbinclude api-collection-identifier-unload
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function PUT_api_collection_unload (req, res, collection) {
|
||||
try {
|
||||
collection.unload();
|
||||
function PUT_api_collection_unload (req, res, collection) {
|
||||
try {
|
||||
collection.unload();
|
||||
|
||||
var result = CollectionRepresentation(collection);
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
var result = CollectionRepresentation(collection);
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief truncates a collection
|
||||
|
@ -506,18 +507,18 @@ function PUT_api_collection_unload (req, res, collection) {
|
|||
/// @verbinclude api-collection-identifier-truncate
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function PUT_api_collection_truncate (req, res, collection) {
|
||||
try {
|
||||
collection.truncate();
|
||||
function PUT_api_collection_truncate (req, res, collection) {
|
||||
try {
|
||||
collection.truncate();
|
||||
|
||||
var result = CollectionRepresentation(collection);
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
var result = CollectionRepresentation(collection);
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief changes a collection
|
||||
|
@ -545,24 +546,24 @@ function PUT_api_collection_truncate (req, res, collection) {
|
|||
/// @verbinclude api-collection-identifier-properties-sync
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function PUT_api_collection_properties (req, res, collection) {
|
||||
var body = actions.getJsonBody(req, res);
|
||||
function PUT_api_collection_properties (req, res, collection) {
|
||||
var body = actions.getJsonBody(req, res);
|
||||
|
||||
if (body === undefined) {
|
||||
return;
|
||||
}
|
||||
if (body === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
collection.properties(body);
|
||||
try {
|
||||
collection.properties(body);
|
||||
|
||||
var result = CollectionRepresentation(collection, true);
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
var result = CollectionRepresentation(collection, true);
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief renames a collection
|
||||
|
@ -586,75 +587,74 @@ function PUT_api_collection_properties (req, res, collection) {
|
|||
/// @verbinclude api-collection-identifier-rename
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function PUT_api_collection_rename (req, res, collection) {
|
||||
var body = actions.getJsonBody(req, res);
|
||||
function PUT_api_collection_rename (req, res, collection) {
|
||||
var body = actions.getJsonBody(req, res);
|
||||
|
||||
if (body === undefined) {
|
||||
return;
|
||||
if (body === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (! body.hasOwnProperty("name")) {
|
||||
actions.resultBad(req, res, actions.ERROR_ARANGO_ILLEGAL_NAME,
|
||||
"name must be non-empty");
|
||||
return;
|
||||
}
|
||||
|
||||
var name = body.name;
|
||||
|
||||
try {
|
||||
collection.rename(name);
|
||||
|
||||
var result = CollectionRepresentation(collection);
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
|
||||
if (! body.hasOwnProperty("name")) {
|
||||
actions.resultBad(req, res, actions.ERROR_ARANGO_ILLEGAL_NAME,
|
||||
"name must be non-empty");
|
||||
return;
|
||||
}
|
||||
|
||||
var name = body.name;
|
||||
|
||||
try {
|
||||
collection.rename(name);
|
||||
|
||||
var result = CollectionRepresentation(collection);
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief changes a collection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function PUT_api_collection (req, res) {
|
||||
function PUT_api_collection (req, res) {
|
||||
if (req.suffix.length != 2) {
|
||||
actions.resultBad(req, res, actions.ERROR_HTTP_BAD_PARAMETER,
|
||||
"expected PUT /" + API + "/<collection-identifer>/<action>");
|
||||
return;
|
||||
}
|
||||
|
||||
if (req.suffix.length != 2) {
|
||||
actions.resultBad(req, res, actions.ERROR_HTTP_BAD_PARAMETER,
|
||||
"expected PUT /" + API + "/<collection-identifer>/<action>");
|
||||
return;
|
||||
}
|
||||
var name = decodeURIComponent(req.suffix[0]);
|
||||
var id = parseInt(name) || name;
|
||||
var collection = internal.db._collection(id);
|
||||
|
||||
var name = decodeURIComponent(req.suffix[0]);
|
||||
var id = parseInt(name) || name;
|
||||
var collection = internal.db._collection(id);
|
||||
|
||||
if (collection === null) {
|
||||
actions.collectionNotFound(req, res, name);
|
||||
return;
|
||||
}
|
||||
if (collection === null) {
|
||||
actions.collectionNotFound(req, res, name);
|
||||
return;
|
||||
}
|
||||
|
||||
var sub = decodeURIComponent(req.suffix[1]);
|
||||
var sub = decodeURIComponent(req.suffix[1]);
|
||||
|
||||
if (sub === "load") {
|
||||
PUT_api_collection_load(req, res, collection);
|
||||
if (sub === "load") {
|
||||
PUT_api_collection_load(req, res, collection);
|
||||
}
|
||||
else if (sub === "unload") {
|
||||
PUT_api_collection_unload(req, res, collection);
|
||||
}
|
||||
else if (sub === "truncate") {
|
||||
PUT_api_collection_truncate(req, res, collection);
|
||||
}
|
||||
else if (sub === "properties") {
|
||||
PUT_api_collection_properties(req, res, collection);
|
||||
}
|
||||
else if (sub === "rename") {
|
||||
PUT_api_collection_rename(req, res, collection);
|
||||
}
|
||||
else {
|
||||
actions.resultNotFound(req, res, "expecting one of the actions 'load', 'unload', 'truncate', 'properties', 'rename'");
|
||||
}
|
||||
}
|
||||
else if (sub === "unload") {
|
||||
PUT_api_collection_unload(req, res, collection);
|
||||
}
|
||||
else if (sub === "truncate") {
|
||||
PUT_api_collection_truncate(req, res, collection);
|
||||
}
|
||||
else if (sub === "properties") {
|
||||
PUT_api_collection_properties(req, res, collection);
|
||||
}
|
||||
else if (sub === "rename") {
|
||||
PUT_api_collection_rename(req, res, collection);
|
||||
}
|
||||
else {
|
||||
actions.resultNotFound(req, res, "expecting one of the actions 'load', 'unload', 'truncate', 'properties', 'rename'");
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief deletes a collection
|
||||
|
@ -689,68 +689,74 @@ function PUT_api_collection (req, res) {
|
|||
/// @verbinclude api-collection-delete-collection-name
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function DELETE_api_collection (req, res) {
|
||||
if (req.suffix.length != 1) {
|
||||
actions.resultBad(req, res, actions.ERROR_HTTP_BAD_PARAMETER,
|
||||
"expected DELETE /" + API + "/<collection-identifer>");
|
||||
}
|
||||
else {
|
||||
var name = decodeURIComponent(req.suffix[0]);
|
||||
var id = parseInt(name) || name;
|
||||
var collection = internal.db._collection(id);
|
||||
|
||||
if (collection === null) {
|
||||
actions.collectionNotFound(req, res, name);
|
||||
function DELETE_api_collection (req, res) {
|
||||
if (req.suffix.length != 1) {
|
||||
actions.resultBad(req, res, actions.ERROR_HTTP_BAD_PARAMETER,
|
||||
"expected DELETE /" + API + "/<collection-identifer>");
|
||||
}
|
||||
else {
|
||||
try {
|
||||
var result = {
|
||||
id : collection._id
|
||||
};
|
||||
var name = decodeURIComponent(req.suffix[0]);
|
||||
var id = parseInt(name) || name;
|
||||
var collection = internal.db._collection(id);
|
||||
|
||||
collection.drop();
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
if (collection === null) {
|
||||
actions.collectionNotFound(req, res, name);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
else {
|
||||
try {
|
||||
var result = {
|
||||
id : collection._id
|
||||
};
|
||||
|
||||
collection.drop();
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultException(req, res, err);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief reads or creates a collection
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
actions.defineHttp({
|
||||
url : API,
|
||||
context : "api",
|
||||
actions.defineHttp({
|
||||
url : API,
|
||||
context : "api",
|
||||
|
||||
callback : function (req, res) {
|
||||
if (req.requestType === actions.GET) {
|
||||
GET_api_collection(req, res);
|
||||
callback : function (req, res) {
|
||||
if (req.requestType === actions.GET) {
|
||||
GET_api_collection(req, res);
|
||||
}
|
||||
else if (req.requestType === actions.DELETE) {
|
||||
DELETE_api_collection(req, res);
|
||||
}
|
||||
else if (req.requestType === actions.POST) {
|
||||
POST_api_collection(req, res);
|
||||
}
|
||||
else if (req.requestType === actions.PUT) {
|
||||
PUT_api_collection(req, res);
|
||||
}
|
||||
else {
|
||||
actions.resultUnsupported(req, res);
|
||||
}
|
||||
}
|
||||
else if (req.requestType === actions.DELETE) {
|
||||
DELETE_api_collection(req, res);
|
||||
}
|
||||
else if (req.requestType === actions.POST) {
|
||||
POST_api_collection(req, res);
|
||||
}
|
||||
else if (req.requestType === actions.PUT) {
|
||||
PUT_api_collection(req, res);
|
||||
}
|
||||
else {
|
||||
actions.resultUnsupported(req, res);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
})();
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Local Variables:
|
||||
// mode: outline-minor
|
||||
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
|
||||
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)"
|
||||
// End:
|
||||
|
|
|
@ -25,12 +25,13 @@
|
|||
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var actions = require("actions");
|
||||
var internal = require("internal");
|
||||
var console = require("internal");
|
||||
(function() {
|
||||
var actions = require("actions");
|
||||
var internal = require("internal");
|
||||
var console = require("internal");
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- administration actions
|
||||
// --SECTION-- helper actions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -42,86 +43,99 @@ var console = require("internal");
|
|||
/// @brief returns system time
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function GET_time (req, res) {
|
||||
actions.resultOk(req, res, actions.HTTP_OK, { time : internal.time() });
|
||||
}
|
||||
function GET_time (req, res) {
|
||||
actions.resultOk(req, res, actions.HTTP_OK, { time : internal.time() });
|
||||
}
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_api/time",
|
||||
context : "api",
|
||||
prefix : false,
|
||||
callback : GET_time
|
||||
});
|
||||
actions.defineHttp({
|
||||
url : "_api/time",
|
||||
context : "api",
|
||||
prefix : false,
|
||||
callback : GET_time
|
||||
});
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin/time",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
callback : GET_time
|
||||
});
|
||||
actions.defineHttp({
|
||||
url : "_admin/time",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
callback : GET_time
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns V8 version
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function GET_v8_version (req, res) {
|
||||
actions.resultOk(req, res, actions.HTTP_OK, { version : "V8" });
|
||||
}
|
||||
function GET_v8_version (req, res) {
|
||||
actions.resultOk(req, res, actions.HTTP_OK, { version : "V8" });
|
||||
}
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin/v8-version",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
callback : GET_v8_version
|
||||
});
|
||||
actions.defineHttp({
|
||||
url : "_admin/v8-version",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
callback : GET_v8_version
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the request
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin/echo",
|
||||
context : "admin",
|
||||
prefix : true,
|
||||
callback : function (req, res) {
|
||||
res.responseCode = actions.HTTP_OK;
|
||||
res.contentType = "application/json";
|
||||
res.body = JSON.stringify(req);
|
||||
actions.defineHttp({
|
||||
url : "_admin/echo",
|
||||
context : "admin",
|
||||
prefix : true,
|
||||
callback : function (req, res) {
|
||||
res.responseCode = actions.HTTP_OK;
|
||||
res.contentType = "application/json";
|
||||
res.body = JSON.stringify(req);
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- administration actions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ActionsAdmin
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns redirection to index page
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function AdminRedirect (req, res) {
|
||||
var dest = "/_admin/html/index.html";
|
||||
|
||||
res.responseCode = actions.HTTP_MOVED_PERMANENTLY;
|
||||
res.contentType = "text/html";
|
||||
|
||||
res.body = "<html><head><title>Moved</title></head><body><h1>Moved</h1><p>This page has moved to <a href=\""
|
||||
+ dest
|
||||
+ "\">"
|
||||
+ dest
|
||||
+ "</a>.</p></body></html>";
|
||||
|
||||
res.headers = { location : dest };
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns system status information for the server
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
actions.defineHttp({
|
||||
url : "",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
callback : AdminRedirect
|
||||
});
|
||||
|
||||
function AdminRedirect (req, res) {
|
||||
var dest = "/_admin/html/index.html";
|
||||
|
||||
res.responseCode = actions.HTTP_MOVED_PERMANENTLY;
|
||||
res.contentType = "text/html";
|
||||
|
||||
res.body = "<html><head><title>Moved</title></head><body><h1>Moved</h1><p>This page has moved to <a href=\""
|
||||
+ dest
|
||||
+ "\">"
|
||||
+ dest
|
||||
+ "</a>.</p></body></html>";
|
||||
|
||||
res.headers = { location : dest };
|
||||
}
|
||||
|
||||
actions.defineHttp({
|
||||
url : "",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
callback : AdminRedirect
|
||||
});
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
callback : AdminRedirect
|
||||
});
|
||||
actions.defineHttp({
|
||||
url : "_admin",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
callback : AdminRedirect
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_GET_admin_status
|
||||
|
@ -158,22 +172,22 @@ actions.defineHttp({
|
|||
/// made which have required loading a memory page from disk.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin/status",
|
||||
context : "admin",
|
||||
actions.defineHttp({
|
||||
url : "_admin/status",
|
||||
context : "admin",
|
||||
|
||||
callback : function (req, res) {
|
||||
try {
|
||||
result = {};
|
||||
result.system = SYS_PROCESS_STAT();
|
||||
callback : function (req, res) {
|
||||
try {
|
||||
result = {};
|
||||
result.system = SYS_PROCESS_STAT();
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultError(req, res, err);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultError(req, res, err);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_GET_admin_config_description
|
||||
|
@ -186,74 +200,74 @@ actions.defineHttp({
|
|||
/// The call returns an object describing the configuration.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin/config/description",
|
||||
context : "admin",
|
||||
actions.defineHttp({
|
||||
url : "_admin/config/description",
|
||||
context : "admin",
|
||||
|
||||
callback : function (req, res) {
|
||||
try {
|
||||
result = {
|
||||
database : {
|
||||
name : "Database",
|
||||
type : "section",
|
||||
|
||||
path : {
|
||||
name : "Path",
|
||||
type : "string",
|
||||
readonly : true
|
||||
},
|
||||
|
||||
access : {
|
||||
name : "Combined Access",
|
||||
type : "string",
|
||||
readonly : true
|
||||
}
|
||||
},
|
||||
|
||||
logging : {
|
||||
name : "Logging",
|
||||
type : "section",
|
||||
|
||||
level : {
|
||||
name : "Log Level",
|
||||
type : "pull-down",
|
||||
values : [ "fatal", "error", "warning", "info", "debug", "trace" ]
|
||||
},
|
||||
|
||||
syslog : {
|
||||
name : "Use Syslog",
|
||||
type : "boolean"
|
||||
},
|
||||
|
||||
bufferSize : {
|
||||
name : "Log Buffer Size",
|
||||
type : "integer"
|
||||
},
|
||||
|
||||
output : {
|
||||
name : "Output",
|
||||
callback : function (req, res) {
|
||||
try {
|
||||
result = {
|
||||
database : {
|
||||
name : "Database",
|
||||
type : "section",
|
||||
|
||||
file : {
|
||||
name : "Log File",
|
||||
path : {
|
||||
name : "Path",
|
||||
type : "string",
|
||||
readonly : true
|
||||
},
|
||||
|
||||
access : {
|
||||
name : "Combined Access",
|
||||
type : "string",
|
||||
readonly : true
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
logging : {
|
||||
name : "Logging",
|
||||
type : "section",
|
||||
|
||||
level : {
|
||||
name : "Log Level",
|
||||
type : "pull-down",
|
||||
values : [ "fatal", "error", "warning", "info", "debug", "trace" ]
|
||||
},
|
||||
|
||||
syslog : {
|
||||
name : "Use Syslog",
|
||||
type : "boolean"
|
||||
},
|
||||
|
||||
bufferSize : {
|
||||
name : "Log Buffer Size",
|
||||
type : "integer"
|
||||
},
|
||||
|
||||
output : {
|
||||
name : "Output",
|
||||
type : "section",
|
||||
|
||||
file : {
|
||||
name : "Log File",
|
||||
type : "string",
|
||||
readonly : true
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultError(req, res, err);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultError(req, res, err);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @fn JSF_GET_admin_config_configuration
|
||||
/// @brief returns configuration description
|
||||
/// @brief returns configuration
|
||||
///
|
||||
/// @RESTHEADER{GET /_admin/config/configuration,reads the configuration}
|
||||
///
|
||||
|
@ -262,57 +276,142 @@ actions.defineHttp({
|
|||
/// The call returns an object containing configuration.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin/config/configuration",
|
||||
context : "admin",
|
||||
actions.defineHttp({
|
||||
url : "_admin/config/configuration",
|
||||
context : "admin",
|
||||
|
||||
callback : function (req, res) {
|
||||
try {
|
||||
result = {
|
||||
database : {
|
||||
path : {
|
||||
value : "/tmp/emil/vocbase"
|
||||
callback : function (req, res) {
|
||||
try {
|
||||
result = {
|
||||
database : {
|
||||
path : {
|
||||
value : "/tmp/emil/vocbase"
|
||||
},
|
||||
|
||||
access : {
|
||||
value : "localhost:8529"
|
||||
}
|
||||
},
|
||||
|
||||
access : {
|
||||
value : "localhost:8529"
|
||||
}
|
||||
},
|
||||
logging : {
|
||||
level : {
|
||||
value : "info"
|
||||
},
|
||||
|
||||
logging : {
|
||||
level : {
|
||||
value : "info"
|
||||
},
|
||||
syslog : {
|
||||
value : true
|
||||
},
|
||||
|
||||
syslog : {
|
||||
value : true
|
||||
},
|
||||
bufferSize : {
|
||||
value : 100
|
||||
},
|
||||
|
||||
bufferSize : {
|
||||
value : 100
|
||||
},
|
||||
|
||||
output : {
|
||||
file : {
|
||||
value : "/var/log/message/arango.log"
|
||||
output : {
|
||||
file : {
|
||||
value : "/var/log/message/arango.log"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultError(req, res, err);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
actions.resultError(req, res, err);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- session actions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ActionsAdmin
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function GET_admin_session (req, res) {
|
||||
var result;
|
||||
var realm;
|
||||
|
||||
if (req.user === null) {
|
||||
realm = "basic realm=\"arangodb\"";
|
||||
|
||||
res.responseCode = actions.HTTP_UNAUTHORIZED;
|
||||
res.headers = { "www-authenticate" : realm };
|
||||
}
|
||||
else {
|
||||
var user = internal.db._collection("_users").firstExample({ user : req.user });
|
||||
|
||||
if (user === null) {
|
||||
actions.resultNotFound(req, res, "unknown user '" + req.user + "'");
|
||||
}
|
||||
else {
|
||||
result = {
|
||||
user : user.user,
|
||||
permissions : user.permissions || []
|
||||
};
|
||||
|
||||
actions.resultOk(req, res, actions.HTTP_OK, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function POST_admin_session (req, res) {
|
||||
actions.resultUnsupported(req, res);
|
||||
}
|
||||
|
||||
function PUT_admin_session (req, res) {
|
||||
actions.resultUnsupported(req, res);
|
||||
}
|
||||
|
||||
function DELETE_admin_session (req, res) {
|
||||
actions.resultUnsupported(req, res);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief session call dispatcher
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
actions.defineHttp({
|
||||
url : "_admin/session",
|
||||
context : "admin",
|
||||
prefix : false,
|
||||
callback : function (req, res) {
|
||||
if (req.requestType === actions.GET) {
|
||||
GET_admin_session(req, res);
|
||||
}
|
||||
else if (req.requestType === actions.DELETE) {
|
||||
DELETE_admin_session(req, res);
|
||||
}
|
||||
else if (req.requestType === actions.POST) {
|
||||
POST_admin_session(req, res);
|
||||
}
|
||||
else if (req.requestType === actions.PUT) {
|
||||
PUT_admin_session(req, res);
|
||||
}
|
||||
else {
|
||||
actions.resultUnsupported(req, res);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
})();
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Local Variables:
|
||||
// mode: outline-minor
|
||||
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
|
||||
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)"
|
||||
// End:
|
||||
|
|
|
@ -282,6 +282,21 @@ static string JS_common_bootstrap_modules =
|
|||
" internal.wait = SYS_WAIT;\n"
|
||||
"\n"
|
||||
"\n"
|
||||
" // password interface\n"
|
||||
" internal.encodePassword = function (password) {\n"
|
||||
" var salt;\n"
|
||||
" var encoded;\n"
|
||||
"\n"
|
||||
" salt = internal.sha256(\"time:\" + SYS_TIME());\n"
|
||||
" salt = salt.substr(0,8);\n"
|
||||
"\n"
|
||||
" encoded = \"$1$\" + salt + \"$\" + internal.sha256(salt + password);\n"
|
||||
" \n"
|
||||
" return encoded;\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\n"
|
||||
" // command line parameter\n"
|
||||
" internal.MODULES_PATH = \"\";\n"
|
||||
"\n"
|
||||
|
@ -291,8 +306,8 @@ static string JS_common_bootstrap_modules =
|
|||
"\n"
|
||||
"\n"
|
||||
" // output \n"
|
||||
" internal.start_pager = function() {};\n"
|
||||
" internal.stop_pager = function() {};\n"
|
||||
" internal.start_pager = function () {};\n"
|
||||
" internal.stop_pager = function () {};\n"
|
||||
"\n"
|
||||
" internal.ARANGO_QUIET = false;\n"
|
||||
"\n"
|
||||
|
|
|
@ -281,6 +281,21 @@ ModuleCache["/internal"] = new Module("/internal");
|
|||
internal.wait = SYS_WAIT;
|
||||
|
||||
|
||||
// password interface
|
||||
internal.encodePassword = function (password) {
|
||||
var salt;
|
||||
var encoded;
|
||||
|
||||
salt = internal.sha256("time:" + SYS_TIME());
|
||||
salt = salt.substr(0,8);
|
||||
|
||||
encoded = "$1$" + salt + "$" + internal.sha256(salt + password);
|
||||
|
||||
return encoded;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// command line parameter
|
||||
internal.MODULES_PATH = "";
|
||||
|
||||
|
@ -290,8 +305,8 @@ ModuleCache["/internal"] = new Module("/internal");
|
|||
|
||||
|
||||
// output
|
||||
internal.start_pager = function() {};
|
||||
internal.stop_pager = function() {};
|
||||
internal.start_pager = function () {};
|
||||
internal.stop_pager = function () {};
|
||||
|
||||
internal.ARANGO_QUIET = false;
|
||||
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- arango-password
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
|
@ -74,7 +78,7 @@ function main (argv) {
|
|||
password = argv[2];
|
||||
}
|
||||
|
||||
var hash = internal.sha256(password);
|
||||
var hash = internal.encodePassword(password);
|
||||
|
||||
if (username == "" ) {
|
||||
internal.output("username must not be empty\n");
|
||||
|
@ -102,6 +106,10 @@ function main (argv) {
|
|||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Local Variables:
|
||||
// mode: outline-minor
|
||||
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- arango-upgrade
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup ArangoDB
|
||||
/// @{
|
||||
|
@ -56,6 +60,7 @@ function main (argv) {
|
|||
|
||||
if (users == null) {
|
||||
users = db._create("_users", { isSystem: true, waitForSync: true });
|
||||
|
||||
if (users == null) {
|
||||
console.error("creating users collection '_users' failed");
|
||||
return false;
|
||||
|
@ -68,6 +73,7 @@ function main (argv) {
|
|||
// create a unique index on username attribute in _users
|
||||
addTask("create index on username attribute in _users collection", function () {
|
||||
var users = db._collection("_users");
|
||||
|
||||
if (users == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -80,13 +86,14 @@ function main (argv) {
|
|||
// add a default root user with no passwd
|
||||
addTask("add default root user", function () {
|
||||
var users = db._collection("_users");
|
||||
|
||||
if (users == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (users.count() == 0) {
|
||||
// only add account if user has not created his/her own accounts already
|
||||
users.save({ user: "root", password: internal.sha256(""), active: true });
|
||||
users.save({ user: "root", password: internal.encodePassword(""), active: true });
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -98,6 +105,7 @@ function main (argv) {
|
|||
|
||||
if (graphs == null) {
|
||||
graphs = db._create("_graphs", { isSystem: true, waitForSync: true });
|
||||
|
||||
if (graphs == null) {
|
||||
console.error("creating graphs collection '_graphs' failed");
|
||||
return false;
|
||||
|
@ -110,6 +118,7 @@ function main (argv) {
|
|||
// create a unique index on name attribute in _graphs
|
||||
addTask("create index on name attribute in _graphs collection", function () {
|
||||
var graphs = db._collection("_graphs");
|
||||
|
||||
if (graphs == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -142,6 +151,7 @@ function main (argv) {
|
|||
var isEdge = true;
|
||||
// check the 1st 50 documents from a collection
|
||||
var documents = collection.ALL(0, 50);
|
||||
|
||||
for (var j in documents) {
|
||||
var doc = documents[j];
|
||||
|
||||
|
@ -179,6 +189,7 @@ function main (argv) {
|
|||
console.log("Executing task #" + i + ": " + task.description);
|
||||
|
||||
var result = task.code();
|
||||
|
||||
if (! result) {
|
||||
console.error("Task failed. Aborting upgrade script.");
|
||||
console.error("Please fix the problem and try running the upgrade script again.");
|
||||
|
@ -198,6 +209,10 @@ function main (argv) {
|
|||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Local Variables:
|
||||
// mode: outline-minor
|
||||
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
|
||||
|
|
|
@ -72,8 +72,6 @@ static string JS_server_server =
|
|||
"/// @}\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"\n"
|
||||
"}());\n"
|
||||
"\n"
|
||||
"// -----------------------------------------------------------------------------\n"
|
||||
"// --SECTION-- Module \"simple-query\"\n"
|
||||
"// -----------------------------------------------------------------------------\n"
|
||||
|
@ -87,16 +85,12 @@ static string JS_server_server =
|
|||
"/// @brief simple-query module\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"\n"
|
||||
"(function () {\n"
|
||||
" var console = require(\"console\");\n"
|
||||
"\n"
|
||||
" try {\n"
|
||||
" require(\"simple-query\");\n"
|
||||
" }\n"
|
||||
" catch (err) {\n"
|
||||
" console.error(\"while loading 'simple-query' module: %s\", err);\n"
|
||||
" }\n"
|
||||
"}());\n"
|
||||
"\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"/// @}\n"
|
||||
|
@ -115,16 +109,12 @@ static string JS_server_server =
|
|||
"/// @brief monkeypatches module\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"\n"
|
||||
"(function () {\n"
|
||||
" var console = require(\"console\");\n"
|
||||
"\n"
|
||||
" try {\n"
|
||||
" require(\"monkeypatches\");\n"
|
||||
" }\n"
|
||||
" catch (err) {\n"
|
||||
" console.error(\"while loading 'monkeypatches' module: %s\", err);\n"
|
||||
" }\n"
|
||||
"}());\n"
|
||||
"\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"/// @}\n"
|
||||
|
@ -139,9 +129,6 @@ static string JS_server_server =
|
|||
"/// @{\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"\n"
|
||||
"(function () {\n"
|
||||
" var internal = require(\"internal\");\n"
|
||||
"\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"/// @brief prints a shaped json\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
|
@ -159,8 +146,6 @@ static string JS_server_server =
|
|||
"/// @}\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"\n"
|
||||
"}());\n"
|
||||
"\n"
|
||||
"// -----------------------------------------------------------------------------\n"
|
||||
"// --SECTION-- ArangoError\n"
|
||||
"// -----------------------------------------------------------------------------\n"
|
||||
|
@ -170,9 +155,6 @@ static string JS_server_server =
|
|||
"/// @{\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"\n"
|
||||
"(function () {\n"
|
||||
" var internal = require(\"internal\");\n"
|
||||
"\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"/// @brief prints an error\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
|
@ -199,8 +181,6 @@ static string JS_server_server =
|
|||
"/// @}\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"\n"
|
||||
"}());\n"
|
||||
"\n"
|
||||
"// -----------------------------------------------------------------------------\n"
|
||||
"// --SECTION-- ArangoDatabase\n"
|
||||
"// -----------------------------------------------------------------------------\n"
|
||||
|
@ -210,9 +190,6 @@ static string JS_server_server =
|
|||
"/// @{\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"\n"
|
||||
"(function () {\n"
|
||||
" var internal = require(\"internal\");\n"
|
||||
"\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"/// @brief drops a collection\n"
|
||||
"///\n"
|
||||
|
@ -415,8 +392,6 @@ static string JS_server_server =
|
|||
"/// @}\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"\n"
|
||||
"}());\n"
|
||||
"\n"
|
||||
"// -----------------------------------------------------------------------------\n"
|
||||
"// --SECTION-- ArangoCollection\n"
|
||||
"// -----------------------------------------------------------------------------\n"
|
||||
|
@ -426,9 +401,6 @@ static string JS_server_server =
|
|||
"/// @{\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"\n"
|
||||
"(function () {\n"
|
||||
" var internal = require(\"internal\");\n"
|
||||
"\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
"/// @brief collection is corrupted\n"
|
||||
"////////////////////////////////////////////////////////////////////////////////\n"
|
||||
|
@ -595,8 +567,12 @@ static string JS_server_server =
|
|||
"\n"
|
||||
"}());\n"
|
||||
"\n"
|
||||
"// -----------------------------------------------------------------------------\n"
|
||||
"// --SECTION-- END-OF-FILE\n"
|
||||
"// -----------------------------------------------------------------------------\n"
|
||||
"\n"
|
||||
"// Local Variables:\n"
|
||||
"// mode: outline-minor\n"
|
||||
"// outline-regexp: \"^\\\\(/// @brief\\\\|/// @addtogroup\\\\|// --SECTION--\\\\|/// @page\\\\|/// @}\\\\)\"\n"
|
||||
"// outline-regexp: \"^\\\\(/// @brief\\\\|/// @addtogroup\\\\|// --SECTION--\\\\|/// @page\\\\|/// @\\\\}\\\\)\"\n"
|
||||
"// End:\n"
|
||||
;
|
||||
|
|
|
@ -71,8 +71,6 @@
|
|||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}());
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- Module "simple-query"
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -86,16 +84,12 @@
|
|||
/// @brief simple-query module
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
(function () {
|
||||
var console = require("console");
|
||||
|
||||
try {
|
||||
require("simple-query");
|
||||
}
|
||||
catch (err) {
|
||||
console.error("while loading 'simple-query' module: %s", err);
|
||||
}
|
||||
}());
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
|
@ -114,16 +108,12 @@
|
|||
/// @brief monkeypatches module
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
(function () {
|
||||
var console = require("console");
|
||||
|
||||
try {
|
||||
require("monkeypatches");
|
||||
}
|
||||
catch (err) {
|
||||
console.error("while loading 'monkeypatches' module: %s", err);
|
||||
}
|
||||
}());
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
|
@ -138,9 +128,6 @@
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
(function () {
|
||||
var internal = require("internal");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief prints a shaped json
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -158,8 +145,6 @@
|
|||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}());
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- ArangoError
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -169,9 +154,6 @@
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
(function () {
|
||||
var internal = require("internal");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief prints an error
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -198,8 +180,6 @@
|
|||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}());
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- ArangoDatabase
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -209,9 +189,6 @@
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
(function () {
|
||||
var internal = require("internal");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief drops a collection
|
||||
///
|
||||
|
@ -414,8 +391,6 @@
|
|||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}());
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- ArangoCollection
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -425,9 +400,6 @@
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
(function () {
|
||||
var internal = require("internal");
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief collection is corrupted
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -594,7 +566,11 @@
|
|||
|
||||
}());
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- END-OF-FILE
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// Local Variables:
|
||||
// mode: outline-minor
|
||||
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
|
||||
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}\\)"
|
||||
// End:
|
||||
|
|
|
@ -216,23 +216,6 @@ void RestBaseHandler::generateError (HttpResponse::HttpResponseCode code, int er
|
|||
delete result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief parses a request body in json given a description
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool RestBaseHandler::parseBody (InputParser::ObjectDescription& desc) {
|
||||
boost::scoped_ptr<VariantArray> json(InputParser::jsonArray(_request));
|
||||
bool ok = desc.parse(json.get());
|
||||
|
||||
if (! ok) {
|
||||
generateError(HttpResponse::BAD,
|
||||
TRI_ERROR_HTTP_CORRUPTED_JSON,
|
||||
desc.lastError());
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief selects an output format
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "HttpServer/HttpHandler.h"
|
||||
|
||||
#include "BasicsC/json.h"
|
||||
#include "JsonParserX/InputParser.h"
|
||||
#include "Rest/HttpResponse.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -144,12 +143,6 @@ namespace triagens {
|
|||
int errorCode,
|
||||
string const& details);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief parses a request body in json given a description
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
virtual bool parseBody (rest::InputParser::ObjectDescription&);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief selects an output format
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include "BasicsC/strings.h"
|
||||
#include "Basics/Exceptions.h"
|
||||
#include "Basics/StringBuffer.h"
|
||||
#include "Logger/Logger.h"
|
||||
|
@ -153,87 +154,6 @@ namespace {
|
|||
|
||||
|
||||
|
||||
char const hexValues[513] = {
|
||||
"000102030405060708090a0b0c0d0e0f"
|
||||
"101112131415161718191a1b1c1d1e1f"
|
||||
"202122232425262728292a2b2c2d2e2f"
|
||||
"303132333435363738393a3b3c3d3e3f"
|
||||
"404142434445464748494a4b4c4d4e4f"
|
||||
"505152535455565758595a5b5c5d5e5f"
|
||||
"606162636465666768696a6b6c6d6e6f"
|
||||
"707172737475767778797a7b7c7d7e7f"
|
||||
"808182838485868788898a8b8c8d8e8f"
|
||||
"909192939495969798999a9b9c9d9e9f"
|
||||
"a0a1a2a3a4a5a6a7a8a9aaabacadaeaf"
|
||||
"b0b1b2b3b4b5b6b7b8b9babbbcbdbebf"
|
||||
"c0c1c2c3c4c5c6c7c8c9cacbcccdcecf"
|
||||
"d0d1d2d3d4d5d6d7d8d9dadbdcdddedf"
|
||||
"e0e1e2e3e4e5e6e7e8e9eaebecedeeef"
|
||||
"f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
|
||||
};
|
||||
|
||||
|
||||
|
||||
uint8_t const hexDecodeLookup[256] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,1,2,3,4,5,6,7,8,9, // 0123456789
|
||||
0,0,0,0,0,0,0, // :;<=>?@
|
||||
10,11,12,13,14,15, // ABCDEF
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0, // GHIJKLMNOPQRS
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0, // TUVWXYZ[/]^_`
|
||||
10,11,12,13,14,15, // abcdef
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
|
||||
|
||||
void hex_encode (const char* source, size_t sourceLen, char** dest, size_t* destLen) {
|
||||
*destLen = (sourceLen * 2);
|
||||
*dest = new char[(*destLen) + 1];
|
||||
|
||||
uint16_t* hex = (uint16_t*) hexValues;
|
||||
uint16_t* pDest = (uint16_t*) *dest;
|
||||
uint8_t* pSource = (uint8_t*) source;
|
||||
|
||||
for (size_t j = 0; j < sourceLen; j++) {
|
||||
*pDest = hex[*pSource];
|
||||
pDest++;
|
||||
pSource++;
|
||||
}
|
||||
|
||||
*((char*) pDest) = 0; // terminate the string
|
||||
}
|
||||
|
||||
|
||||
|
||||
void hex_decode (const char* source, size_t sourceLen, char** dest, size_t* destLen) {
|
||||
*destLen = (sourceLen / 2);
|
||||
*dest = new char[(*destLen) + 1];
|
||||
|
||||
uint8_t* pSource = (uint8_t*) source;
|
||||
uint8_t* pDest = (uint8_t*) *dest;
|
||||
|
||||
for (size_t j = 0; j < sourceLen; j += 2) {
|
||||
uint8_t d = hexDecodeLookup[*pSource++ ] << 4;
|
||||
d |= hexDecodeLookup[*pSource++ ];
|
||||
|
||||
*pDest++ = d;
|
||||
}
|
||||
|
||||
*pDest = 0; // terminate the string
|
||||
}
|
||||
|
||||
bool parseHexanumber (char const *inputStr, size_t len, uint32_t * outputInt) {
|
||||
const uint32_t charVal[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
|
||||
bool ok = true;
|
||||
|
@ -3334,9 +3254,9 @@ namespace triagens {
|
|||
char* tmp;
|
||||
size_t len;
|
||||
|
||||
hex_encode(str.c_str(), str.length(), &tmp, &len);
|
||||
tmp = TRI_EncodeHexString(str.c_str(), str.length(), &len);
|
||||
string result = string(tmp, len);
|
||||
delete[] tmp;
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, tmp);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -3347,9 +3267,9 @@ namespace triagens {
|
|||
char* tmp;
|
||||
size_t len;
|
||||
|
||||
hex_decode(str.c_str(), str.length(), &tmp, &len);
|
||||
tmp = TRI_DecodeHexString(str.c_str(), str.length(), &len);
|
||||
string result = string(tmp, len);
|
||||
delete[] tmp;
|
||||
TRI_FreeString(TRI_CORE_MEM_ZONE, tmp);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "BasicsC/string-buffer.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions for string to number
|
||||
// --SECTION-- public functions for string to something
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -39,6 +39,24 @@
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief converts a single hex to an integer
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_IntHex (char ch, int errorValue) {
|
||||
if ('0' <= ch && ch <= '9') {
|
||||
return ch - '0';
|
||||
}
|
||||
else if ('A' <= ch && ch <= 'F') {
|
||||
return ch - 'A' + 10;
|
||||
}
|
||||
else if ('a' <= ch && ch <= 'f') {
|
||||
return ch - 'a' + 10;
|
||||
}
|
||||
|
||||
return errorValue;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief convert to boolean from string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -35,7 +35,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- public functions for string to number
|
||||
// --SECTION-- public functions for string to something
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -43,6 +43,12 @@ extern "C" {
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief converts a single hex to an integer
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_IntHex (char ch, int errorValue);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief convert to boolean from string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -27,6 +27,72 @@
|
|||
|
||||
#include "strings.h"
|
||||
|
||||
#include <openssl/sha.h>
|
||||
|
||||
#include "BasicsC/conversions.h"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @addtogroup Strings
|
||||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief hex values for all characters
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static char const HexValues[513] = {
|
||||
"000102030405060708090a0b0c0d0e0f"
|
||||
"101112131415161718191a1b1c1d1e1f"
|
||||
"202122232425262728292a2b2c2d2e2f"
|
||||
"303132333435363738393a3b3c3d3e3f"
|
||||
"404142434445464748494a4b4c4d4e4f"
|
||||
"505152535455565758595a5b5c5d5e5f"
|
||||
"606162636465666768696a6b6c6d6e6f"
|
||||
"707172737475767778797a7b7c7d7e7f"
|
||||
"808182838485868788898a8b8c8d8e8f"
|
||||
"909192939495969798999a9b9c9d9e9f"
|
||||
"a0a1a2a3a4a5a6a7a8a9aaabacadaeaf"
|
||||
"b0b1b2b3b4b5b6b7b8b9babbbcbdbebf"
|
||||
"c0c1c2c3c4c5c6c7c8c9cacbcccdcecf"
|
||||
"d0d1d2d3d4d5d6d7d8d9dadbdcdddedf"
|
||||
"e0e1e2e3e4e5e6e7e8e9eaebecedeeef"
|
||||
"f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff"
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief integer values for all hex characters
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static uint8_t const HexDecodeLookup[256] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,1,2,3,4,5,6,7,8,9, // 0123456789
|
||||
0,0,0,0,0,0,0, // :;<=>?@
|
||||
10,11,12,13,14,15, // ABCDEF
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0, // GHIJKLMNOPQRS
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0, // TUVWXYZ[/]^_`
|
||||
10,11,12,13,14,15, // abcdef
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// --SECTION-- private functions
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -818,21 +884,76 @@ void TRI_FreeString (TRI_memory_zone_t* zone, char* value) {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief converts a single hex to an integer
|
||||
/// @brief converts into hex reqpresentation
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_IntHex (char ch, int errorValue) {
|
||||
if ('0' <= ch && ch <= '9') {
|
||||
return ch - '0';
|
||||
}
|
||||
else if ('A' <= ch && ch <= 'F') {
|
||||
return ch - 'A' + 10;
|
||||
}
|
||||
else if ('a' <= ch && ch <= 'f') {
|
||||
return ch - 'a' + 10;
|
||||
char* TRI_EncodeHexString (char const* source, size_t sourceLen, size_t* dstLen) {
|
||||
char* result;
|
||||
uint16_t* hex;
|
||||
uint16_t* dst;
|
||||
uint8_t* src;
|
||||
size_t j;
|
||||
|
||||
*dstLen = (sourceLen * 2);
|
||||
dst = TRI_Allocate(TRI_CORE_MEM_ZONE, (*dstLen) + 1, false);
|
||||
result = (char*) dst;
|
||||
|
||||
hex = (uint16_t*) HexValues;
|
||||
src = (uint8_t*) source;
|
||||
|
||||
for (j = 0; j < sourceLen; j++) {
|
||||
*dst = hex[*src];
|
||||
dst++;
|
||||
src++;
|
||||
}
|
||||
|
||||
return errorValue;
|
||||
*((char*) dst) = 0; // terminate the string
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief converts from hex reqpresentation
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char* TRI_DecodeHexString (char const* source, size_t sourceLen, size_t* dstLen) {
|
||||
char* result;
|
||||
uint8_t* dst;
|
||||
uint8_t* src;
|
||||
uint8_t d;
|
||||
size_t j;
|
||||
|
||||
*dstLen = (sourceLen / 2);
|
||||
dst = TRI_Allocate(TRI_CORE_MEM_ZONE, (*dstLen) + 1, false);
|
||||
result = (char*) dst;
|
||||
|
||||
src = (uint8_t*) source;
|
||||
|
||||
for (j = 0; j < sourceLen; j += 2) {
|
||||
d = HexDecodeLookup[*src++] << 4;
|
||||
d |= HexDecodeLookup[*src++];
|
||||
|
||||
*dst++ = d;
|
||||
}
|
||||
|
||||
*dst = 0; // terminate the string
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sha256 of a string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char* TRI_SHA256String (char const* source, size_t sourceLen, size_t* dstLen) {
|
||||
unsigned char* dst;
|
||||
|
||||
dst = TRI_Allocate(TRI_CORE_MEM_ZONE, SHA256_DIGEST_LENGTH, false);
|
||||
*dstLen = SHA256_DIGEST_LENGTH;
|
||||
|
||||
SHA256((unsigned char const*) source, sourceLen, dst);
|
||||
|
||||
return (char*) dst;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -208,10 +208,22 @@ void TRI_FreeString (TRI_memory_zone_t*, char*);
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief converts a single hex to an integer
|
||||
/// @brief converts into hex reqpresentation
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int TRI_IntHex (char ch, int errorValue);
|
||||
char* TRI_EncodeHexString (char const* source, size_t sourceLen, size_t* dstLen);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief converts from hex reqpresentation
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char* TRI_DecodeHexString (char const* source, size_t sourceLen, size_t* dstLen);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sha256 of a string
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char* TRI_SHA256String (char const* source, size_t sourceLen, size_t* dstLen);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief escapes special characters using C escapes
|
||||
|
@ -259,6 +271,12 @@ char* TRI_UnescapeUtf8String (char const* in, size_t inLength, size_t* outLength
|
|||
|
||||
char* TRI_UnescapeUtf8StringZ (TRI_memory_zone_t*, char const* in, size_t inLength, size_t* outLength);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief unescapes unicode escape sequences
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
char* TRI_UnescapeUtf8StringZ (TRI_memory_zone_t*, char const* in, size_t inLength, size_t* outLength);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "BasicsC/terminal-utils.h"
|
||||
|
||||
#ifdef HAVE_NCURSES
|
||||
#ifdef TRI_HAVE_NCURSES
|
||||
|
||||
#include <term.h>
|
||||
#include <curses.h>
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
/// @brief returns the columns width
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if ! defined(HAVE_NCURSES) && ! defined(TRI_WIN32_CONSOLE)
|
||||
#if ! defined(TRI_HAVE_NCURSES) && ! defined(TRI_WIN32_CONSOLE)
|
||||
|
||||
int TRI_ColumnsWidth (void) {
|
||||
char* e;
|
||||
|
|
|
@ -144,7 +144,7 @@ bool ApplicationEndpointServer::buildServers () {
|
|||
|
||||
// turn off authentication
|
||||
if (_disableAuthentication) {
|
||||
_handlerFactory->setAuthenticationCallback(0);
|
||||
_handlerFactory->setRequireAuthentication(false);
|
||||
LOGGER_INFO << "Authentication is turned off";
|
||||
}
|
||||
|
||||
|
|
|
@ -274,6 +274,10 @@ namespace triagens {
|
|||
|
||||
this->_requestPending = true;
|
||||
|
||||
// .............................................................................
|
||||
// keep-alive handling
|
||||
// .............................................................................
|
||||
|
||||
string connectionType = triagens::basics::StringUtils::tolower(this->_request->header("connection"));
|
||||
|
||||
if (connectionType == "close") {
|
||||
|
@ -298,6 +302,10 @@ namespace triagens {
|
|||
this->_bodyPosition = 0;
|
||||
this->_bodyLength = 0;
|
||||
|
||||
// .............................................................................
|
||||
// authenticate
|
||||
// .............................................................................
|
||||
|
||||
bool auth = this->_server->getHandlerFactory()->authenticateRequest(this->_request);
|
||||
|
||||
// authenticated
|
||||
|
|
|
@ -59,6 +59,7 @@ HttpHandlerFactory::HttpHandlerFactory (std::string const& authenticationRealm,
|
|||
auth_fptr checkAuthentication)
|
||||
: _authenticationRealm(authenticationRealm),
|
||||
_checkAuthentication(checkAuthentication),
|
||||
_requireAuthentication(true),
|
||||
_notFound(0) {
|
||||
}
|
||||
|
||||
|
@ -69,6 +70,7 @@ HttpHandlerFactory::HttpHandlerFactory (std::string const& authenticationRealm,
|
|||
HttpHandlerFactory::HttpHandlerFactory (HttpHandlerFactory const& that)
|
||||
: _authenticationRealm(that._authenticationRealm),
|
||||
_checkAuthentication(that._checkAuthentication),
|
||||
_requireAuthentication(that._requireAuthentication),
|
||||
_constructors(that._constructors),
|
||||
_datas(that._datas),
|
||||
_prefixes(that._prefixes),
|
||||
|
@ -83,6 +85,7 @@ HttpHandlerFactory& HttpHandlerFactory::operator= (HttpHandlerFactory const& tha
|
|||
if (this != &that) {
|
||||
_authenticationRealm = that._authenticationRealm,
|
||||
_checkAuthentication = that._checkAuthentication,
|
||||
_requireAuthentication = that._requireAuthentication;
|
||||
_constructors = that._constructors;
|
||||
_datas = that._datas;
|
||||
_prefixes = that._prefixes;
|
||||
|
@ -112,6 +115,24 @@ HttpHandlerFactory::~HttpHandlerFactory () {
|
|||
/// @{
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief require authentication
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HttpHandlerFactory::setRequireAuthentication (bool value) {
|
||||
_requireAuthentication = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns header and body size restrictions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pair<size_t, size_t> HttpHandlerFactory::sizeRestrictions () const {
|
||||
static size_t m = (size_t) -1;
|
||||
|
||||
return make_pair(m, m);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief authenticates a new request
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -137,8 +158,11 @@ bool HttpHandlerFactory::authenticateRequest (HttpRequest* request) {
|
|||
|
||||
{
|
||||
READ_LOCKER(_authLock);
|
||||
|
||||
map<string,string>::iterator i = _authCache.find(auth);
|
||||
|
||||
if (_authCache.find(auth) != _authCache.end()) {
|
||||
if (i != _authCache.end()) {
|
||||
request->setUser(i->second);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -150,32 +174,19 @@ bool HttpHandlerFactory::authenticateRequest (HttpRequest* request) {
|
|||
return false;
|
||||
}
|
||||
|
||||
char* sha265 = 0;
|
||||
size_t sha265Len;
|
||||
|
||||
SslInterface::sslSHA256(split[1].c_str(), split[1].size(), sha265, sha265Len);
|
||||
|
||||
char* hex = 0;
|
||||
size_t hexLen;
|
||||
|
||||
SslInterface::sslHEX(sha265, sha265Len, hex, hexLen);
|
||||
|
||||
delete[] sha265;
|
||||
|
||||
bool res = _checkAuthentication(split[0].c_str(), hex);
|
||||
|
||||
delete[] hex;
|
||||
bool res = _checkAuthentication(split[0].c_str(), split[1].c_str());
|
||||
|
||||
if (res) {
|
||||
WRITE_LOCKER(_authLock);
|
||||
|
||||
_authCache.insert(auth);
|
||||
_authCache[auth] = split[0];
|
||||
request->setUser(split[0]);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
return false;
|
||||
return _requireAuthentication ? false : true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -186,16 +197,6 @@ string const& HttpHandlerFactory::authenticationRealm (HttpRequest*) const {
|
|||
return _authenticationRealm;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns header and body size restrictions
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
pair<size_t, size_t> HttpHandlerFactory::sizeRestrictions () const {
|
||||
static size_t m = (size_t) -1;
|
||||
|
||||
return make_pair(m, m);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief creates a new request
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -159,12 +159,10 @@ namespace triagens {
|
|||
public:
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief set authentication callback
|
||||
/// @brief require authentication
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void setAuthenticationCallback (auth_fptr checkAuthentication) {
|
||||
_checkAuthentication = checkAuthentication;
|
||||
}
|
||||
void setRequireAuthentication (bool);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns header and body size restrictions
|
||||
|
@ -249,6 +247,12 @@ namespace triagens {
|
|||
|
||||
auth_fptr _checkAuthentication;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief require authentication
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool _requireAuthentication;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief authentication lock for cache
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -259,7 +263,7 @@ namespace triagens {
|
|||
/// @brief authentication cache
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::set<std::string> _authCache;
|
||||
std::map<std::string, std::string> _authCache;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief list of constructors
|
||||
|
|
|
@ -56,10 +56,6 @@ lib_libarango_a_SOURCES = \
|
|||
lib/BasicsC/vector.c \
|
||||
lib/BasicsC/voc-errors.c \
|
||||
lib/JsonParser/json-parser.c \
|
||||
lib/JsonParserX/InputParser.cpp \
|
||||
lib/JsonParserX/JsonParserX.cpp \
|
||||
lib/JsonParserX/JsonParserXDriver.cpp \
|
||||
lib/JsonParserX/JsonScannerX.cpp \
|
||||
lib/Logger/Logger.cpp \
|
||||
lib/Logger/LoggerData.cpp \
|
||||
lib/Logger/LoggerInfo.cpp \
|
||||
|
@ -175,7 +171,6 @@ lib_libarango_fe_a_SOURCES = \
|
|||
lib/UserManager/ApplicationUserManager.cpp \
|
||||
lib/UserManager/Role.cpp \
|
||||
lib/UserManager/Session.cpp \
|
||||
lib/UserManager/SessionHandler.cpp \
|
||||
lib/UserManager/User.cpp \
|
||||
lib/UserManager/UserHandler.cpp \
|
||||
lib/UserManager/UsersHandler.cpp
|
||||
|
@ -222,15 +217,7 @@ FLEX_FILES += \
|
|||
################################################################################
|
||||
|
||||
FLEXXX_FILES += \
|
||||
lib/V8/v8-json.cpp \
|
||||
lib/JsonParserX/JsonScannerX.cpp
|
||||
|
||||
################################################################################
|
||||
### @brief bison++
|
||||
################################################################################
|
||||
|
||||
BISONXX_FILES += \
|
||||
lib/JsonParserX/JsonParserX.cpp
|
||||
lib/V8/v8-json.cpp
|
||||
|
||||
################################################################################
|
||||
### @brief protocol buffers
|
||||
|
|
|
@ -58,7 +58,8 @@ HttpRequest::HttpRequest ()
|
|||
_type(HTTP_REQUEST_ILLEGAL),
|
||||
_prefix(),
|
||||
_suffix(),
|
||||
_version(HTTP_1_0) {
|
||||
_version(HTTP_1_0),
|
||||
_user() {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -129,6 +130,22 @@ bool HttpRequest::isHttp11 () {
|
|||
return _version == HTTP_1_1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the authenticated user
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string const& HttpRequest::user () {
|
||||
return _user;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets the authenticated user
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void HttpRequest::setUser (string const& user) {
|
||||
_user = user;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -192,6 +192,18 @@ namespace triagens {
|
|||
|
||||
virtual void write (TRI_string_buffer_t*) const = 0;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns the authenticated user
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
std::string const& user ();
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief sets the authenticated user
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void setUser (std::string const& user);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -407,6 +419,12 @@ namespace triagens {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
HttpVersion _version;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief authenticated user
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
string _user;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,8 +39,6 @@
|
|||
#include "SimpleHttpResult.h"
|
||||
#include "Basics/StringUtils.h"
|
||||
|
||||
#include "JsonParserX/JsonParserXDriver.h"
|
||||
|
||||
using namespace triagens::basics;
|
||||
using namespace std;
|
||||
|
||||
|
@ -154,33 +152,5 @@ namespace triagens {
|
|||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
VariantObject* SimpleHttpResult::getBodyAsVariant () {
|
||||
|
||||
triagens::rest::JsonParserXDriver parser;
|
||||
VariantObject* result = parser.parse(_resultBody.str());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
VariantArray* SimpleHttpResult::getBodyAsVariantArray () {
|
||||
|
||||
basics::VariantObject* v = getBodyAsVariant();
|
||||
|
||||
if (!v) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
basics::VariantArray* array = dynamic_cast<basics::VariantArray*> (v);
|
||||
|
||||
if (!array) {
|
||||
delete v;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,8 @@ typedef struct TRI_v8_global_s {
|
|||
ParametersKey(),
|
||||
PrefixKey(),
|
||||
ResponseCodeKey(),
|
||||
SuffixKey(),
|
||||
UserKey(),
|
||||
WaitForSyncKey(),
|
||||
DocumentIdRegex(),
|
||||
IndexIdRegex() {
|
||||
|
@ -343,6 +345,12 @@ typedef struct TRI_v8_global_s {
|
|||
|
||||
v8::Persistent<v8::String> SuffixKey;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief "user" key name
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
v8::Persistent<v8::String> UserKey;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief "waitForSync" key name
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue