Quellcode durchsuchen

fix APIKey assignment

rewrite upload_document_2_art.cmd to support UserGetAPIKeyCommand
Dalibor Votruba vor 4 Jahren
Ursprung
Commit
8396dce214

+ 1 - 1
Console/Commands/Base/AbstractWorkspaceCommand.cs

@@ -47,7 +47,7 @@ namespace BO.Console.Commands.Base
             if (!string.IsNullOrEmpty(apiKey))
                 ApiKey = apiKey;
             if (!string.IsNullOrEmpty(apiKeyPassword))
-                ApiKey = apiKeyPassword;
+                ApiKeyPassword = apiKeyPassword;
 
             if (string.IsNullOrEmpty(ApiKey) || string.IsNullOrEmpty(ApiKeyPassword))
                 throw new ArgumentException(

+ 3 - 1
Console/Commands/User/UserGetAPIKeyCommand.cs

@@ -19,7 +19,7 @@ namespace BO.Console.Commands.User
     {
         #region *** Constants ***
         private const string CS_CMD_USERGET_NAME = "user_getapikey";
-        private const string CS_CMD_USERGET_DESCR = "Get default single user workspace api-key or api-password and process result.";
+        private const string CS_CMD_USERGET_DESCR = "Get default single user workspace api-key or api-password and process result. Should be run as Administrator.";
 
         private const string CS_ARG_NAME_TYPE = "outt";
         private const string CS_ARG_HINT_TYPE = "<output_target>";
@@ -75,6 +75,8 @@ namespace BO.Console.Commands.User
                     WriteCaption($"Value '{value}' was set to clipboard.");
                     break;
                 case OutputTargetEnum.Var:
+                    WriteWarning("This feature must run in Administration mode (as Administrator).");
+
                     if (ValueType == ValueTypeApiKeyEnum.ApiKey || ValueType == ValueTypeApiKeyEnum.ApiBoth)
                     {
                         Environment.SetEnvironmentVariable(CS_ENV_VAR_VALUE_KEY, workspace.ApiKeyNormalized, EnvironmentVariableTarget.Process);

+ 1 - 1
Console/Properties/launchSettings.json

@@ -2,7 +2,7 @@
   "profiles": {
     "Console": {
       "commandName": "Project",
-      "commandLineArgs": "user_getapikey -name:test -outt:clp"
+      "commandLineArgs": "help document_add"
     }
   }
 }

+ 3 - 2
Console/Samples/upload_document_2_art.cmd

@@ -1,8 +1,9 @@
 REM ** Uploads 2 artifacts to one new created document (if not exists - otherwise append arts) in default workspace (api-key is defined in console.json) **
-REM ** AppServer must be started first / this script must be run in same directory as BO.Console**
+REM ** AppServer must be started first / this script must be run in same directory as BO.Console / SHOULD be run As Administrator **
 @echo off
 call setenv.cmd
 set oldcd=%cd%
 cd %BOPath% 
-%BOConsole% document_add -arts:%oldcd%\doc1_file1.bin;%oldcd%\doc1_file2.bin -force -user:test
+%BOConsole% user_getapikey -name:test -outt:var
+%BOConsole% document_add -arts:%oldcd%\doc1_file1.bin;%oldcd%\doc1_file2.bin -force -user:test -akey:%bo_apikey% -akeyp:%bo_apipwd%
 cd %oldcd%