]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Add interface to manage API basic users from Web component side
authorMarcin Haba <marcin.haba@bacula.pl>
Fri, 12 Nov 2021 19:28:09 +0000 (20:28 +0100)
committerEric Bollengier <eric@baculasystems.com>
Thu, 24 Mar 2022 08:03:27 +0000 (09:03 +0100)
12 files changed:
gui/baculum/protected/Web/Lang/en/messages.mo
gui/baculum/protected/Web/Lang/en/messages.po
gui/baculum/protected/Web/Lang/ja/messages.mo
gui/baculum/protected/Web/Lang/ja/messages.po
gui/baculum/protected/Web/Lang/pl/messages.mo
gui/baculum/protected/Web/Lang/pl/messages.po
gui/baculum/protected/Web/Lang/pt/messages.mo
gui/baculum/protected/Web/Lang/pt/messages.po
gui/baculum/protected/Web/Lang/ru/messages.mo
gui/baculum/protected/Web/Lang/ru/messages.po
gui/baculum/protected/Web/Pages/Security.page
gui/baculum/protected/Web/Pages/Security.php

index dd33943e8abdf9cd65bf5be6a671f16b10cbb459..9b60339571dd4c8eb481fca8d4219972a7789b4c 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/en/messages.mo and b/gui/baculum/protected/Web/Lang/en/messages.mo differ
index 124faafb3b68c4a81b28bebf1a512c033999f257..b0cc4e9ee14b540d4ade1d4e9d9dad1a2a0476c5 100644 (file)
@@ -3032,8 +3032,8 @@ msgstr "Console ACL to use in new Bconsole config file:"
 msgid "Director for Bconsole config:"
 msgstr "Director for Bconsole config:"
 
-msgid "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the OAuth2 clients that can be used in API hosts. The assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
-msgstr "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the OAuth2 clients that can be used in API hosts. The assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
+msgid "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the API basic users or to the OAuth2 clients. The assign relation for the basic users is: Console ACL -&gt; API basic user -&gt; API host -&gt; User account. For OAuth2 clients the assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
+msgstr "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the API basic users or to the OAuth2 clients. The assign relation for the basic users is: Console ACL -&gt; API basic user -&gt; API host -&gt; User account. For OAuth2 clients the assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
 
 msgid "The OAuth2 clients are configured on the API hosts. To create the OAuth2 clients from this page, you need to have an 'oauth2' scope in OAuth2 account related to your current admin user account. The OAuth2 client accounts are also possible to create directly in the panel of the Baculum API."
 msgstr "The OAuth2 clients are configured on the API hosts. To create the OAuth2 clients from this page, you need to have an 'oauth2' scope in OAuth2 account related to your current admin user account. The OAuth2 client accounts are also possible to create directly in the panel of the Baculum API."
@@ -3889,3 +3889,45 @@ msgstr "The messages log window enables to review Bacula logs in one place avail
 
 msgid "Copy configuration from:"
 msgstr "Copy configuration from:"
+
+msgid "API basic users"
+msgstr "API basic users"
+
+msgid "API OAuth2 clients"
+msgstr "API OAuth2 clients"
+
+msgid "The API basic users are configured on the API hosts and they are used to access the API hosts. Changes introduced on this page are directly done on currently used API host. You can use the basic user credentials to connect API hosts to the Baculum Web on the 'API hosts' tab. The basic user accounts are also possible to create directly in the panel of the Baculum API."
+msgstr "The API basic users are configured on the API hosts and they are used to access the API hosts. Changes introduced on this page are directly done on currently used API host. You can use the basic user credentials to connect API hosts to the Baculum Web on the 'API hosts' tab. The basic user accounts are also possible to create directly in the panel of the Baculum API."
+
+msgid "Add new API basic user"
+msgstr "Add new API basic user"
+
+msgid "API basic username:"
+msgstr "API basic username:"
+
+msgid "API basic password:"
+msgstr "API basic password:"
+
+msgid "Retype password:"
+msgstr "Retype password:"
+
+msgid "Add API basic user account"
+msgstr "Add API basic user account"
+
+msgid "Edit API basic user account"
+msgstr "Edit API basic user account"
+
+msgid "Password must be longer than 4 chars and not longer than 60 chars."
+msgstr "Password must be longer than 4 chars and not longer than 60 chars."
+
+msgid "Please retype password."
+msgstr "Please retype password."
+
+msgid "Invalid user. User may contain a-z A-Z 0-9 characters."
+msgstr "Invalid user. User may contain a-z A-Z 0-9 characters."
+
+msgid "Dedicated Bconsole config"
+msgstr "Dedicated Bconsole config"
+
+msgid "Get existing basic user name:"
+msgstr "Get existing basic user name:"
index 795eb23737a0f390bb934ef351572c877a1fa4d4..4c62efb98b3b0febe2d7c02c02c77a3e5d201cdd 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/ja/messages.mo and b/gui/baculum/protected/Web/Lang/ja/messages.mo differ
index e1cb0abb02378ea7a0b9d1c8a806b4c38cb4ffe9..4ba08d11557a3bbac1caaebf310a8b500a8d6747 100644 (file)
@@ -3118,8 +3118,8 @@ msgstr "Console ACL to use in new Bconsole config file:"
 msgid "Director for Bconsole config:"
 msgstr "Director for Bconsole config:"
 
-msgid "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the OAuth2 clients that can be used in API hosts. The assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
-msgstr "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the OAuth2 clients that can be used in API hosts. The assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
+msgid "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the API basic users or to the OAuth2 clients. The assign relation for the basic users is: Console ACL -&gt; API basic user -&gt; API host -&gt; User account. For OAuth2 clients the assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
+msgstr "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the API basic users or to the OAuth2 clients. The assign relation for the basic users is: Console ACL -&gt; API basic user -&gt; API host -&gt; User account. For OAuth2 clients the assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
 
 msgid "The OAuth2 clients are configured on the API hosts. To create the OAuth2 clients from this page, you need to have an 'oauth2' scope in OAuth2 account related to your current admin user account. The OAuth2 client accounts are also possible to create directly in the panel of the Baculum API."
 msgstr "The OAuth2 clients are configured on the API hosts. To create the OAuth2 clients from this page, you need to have an 'oauth2' scope in OAuth2 account related to your current admin user account. The OAuth2 client accounts are also possible to create directly in the panel of the Baculum API."
@@ -3975,3 +3975,45 @@ msgstr "The messages log window enables to review Bacula logs in one place avail
 
 msgid "Copy configuration from:"
 msgstr "Copy configuration from:"
+
+msgid "API basic users"
+msgstr "API basic users"
+
+msgid "API OAuth2 clients"
+msgstr "API OAuth2 clients"
+
+msgid "The API basic users are configured on the API hosts and they are used to access the API hosts. Changes introduced on this page are directly done on currently used API host. You can use the basic user credentials to connect API hosts to the Baculum Web on the 'API hosts' tab. The basic user accounts are also possible to create directly in the panel of the Baculum API."
+msgstr "The API basic users are configured on the API hosts and they are used to access the API hosts. Changes introduced on this page are directly done on currently used API host. You can use the basic user credentials to connect API hosts to the Baculum Web on the 'API hosts' tab. The basic user accounts are also possible to create directly in the panel of the Baculum API."
+
+msgid "Add new API basic user"
+msgstr "Add new API basic user"
+
+msgid "API basic username:"
+msgstr "API basic username:"
+
+msgid "API basic password:"
+msgstr "API basic password:"
+
+msgid "Retype password:"
+msgstr "Retype password:"
+
+msgid "Add API basic user account"
+msgstr "Add API basic user account"
+
+msgid "Edit API basic user account"
+msgstr "Edit API basic user account"
+
+msgid "Please retype password."
+msgstr "Please retype password."
+
+msgid "Password must be longer than 4 chars and not longer than 60 chars."
+msgstr "Password must be longer than 4 chars and not longer than 60 chars."
+
+msgid "Invalid user. User may contain a-z A-Z 0-9 characters."
+msgstr "Invalid user. User may contain a-z A-Z 0-9 characters."
+
+msgid "Dedicated Bconsole config"
+msgstr "Dedicated Bconsole config"
+
+msgid "Get existing basic user name:"
+msgstr "Get existing basic user name:"
index e7a190612392a8604bd3a9347da6b18e57fcf468..cc02a0565c153c202503950253a0fbd6bfd43bfc 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/pl/messages.mo and b/gui/baculum/protected/Web/Lang/pl/messages.mo differ
index 40711ae0d4d0e5a4356fc42f672fc048d922acbe..7c5b24bb54f125fa36bdcccd7f40dffb19d8720b 100644 (file)
@@ -3042,8 +3042,8 @@ msgstr "Konsole ACL do użycia w nowym pliku konfiguracyjnym:"
 msgid "Director for Bconsole config:"
 msgstr "Zarządca dla pliku konfiguracyjnego Bconsole:"
 
-msgid "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the OAuth2 clients that can be used in API hosts. The assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
-msgstr "Konsole ACL umożliwiają zdefiniowanie dostępnych zasobów dla użytkowników. Konsole są używane w konfiguracji Bacula po stronie hosta API. Jest możliwe przypisanie konsoli do klientów OAuth2, którzy mogą być użyci w hostach API. Relacja przypisania jest: Console ACL -&gt; Klient OAuth2 -&gt; Host API -&gt; Konto użytkownika."
+msgid "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the API basic users or to the OAuth2 clients. The assign relation for the basic users is: Console ACL -&gt; API basic user -&gt; API host -&gt; User account. For OAuth2 clients the assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
+msgstr "Konsole ACL umożliwiają zdefiniowanie dostępnych zasobów dla użytkowników. Konsole są używane w konfiguracji Bacula. Jest możliwe przypisanie konsoli do użytkowników API basic lub do klientów OAuth2. Relacja przypisania dla użytkowników API basic jest następująca: Console ACL -&gt; Użytkownik API basic -&gt; Host API -&gt; Konto użytkownika. Dla klientów OAuth2 relacja przypisania to: Console ACL -&gt; Klient OAuth2 -&gt; Host API -&gt; Konto użytkownika."
 
 msgid "The OAuth2 clients are configured on the API hosts. To create the OAuth2 clients from this page, you need to have an 'oauth2' scope in OAuth2 account related to your current admin user account. The OAuth2 client accounts are also possible to create directly in the panel of the Baculum API."
 msgstr "Klienci OAuth2 są konfigurowani na hostach API. Aby stworzyć klienta OAuth2 z tej strony, potrzebujesz przypisać zakres 'oauth2' na koncie OAuth2 powiązanym z twoim obecnym kontem administratora. Konto klienta OAuth2 można stworzyć również bezpośrednio w panelu Baculum API."
@@ -3847,55 +3847,97 @@ msgid "The pool has not been renamed but it has been copied with the new name. P
 msgstr "Nazwa puli wolumenów nie została zmieniona ale pula została skopiowana z nową nazwą. Proszę mieć na uwadze, że jeżeli pierwotna pula wolumenów zawierała wolumeny to nie zostały one przeniesione i ciągle istnieją one przypisane do pierwotnej puli w bazie danych. Aby przypisać wolumeny z pierwotnej puli do tej puli wolumenów, proszę przejść do MENU GŁÓWNE &#10148; Pule wolumenów &#10148; [NOWA PULA] &#10148; Zakładka: Akcje i proszę użyć przycisku 'Przypisz wolumeny'. Po przypisaniu wolumenów możesz usunąć pierwotną pulę."
 
 msgid "Add Connect directive"
-msgstr "Add Connect directive"
+msgstr "Dodaj dyrektywę Connect"
 
 msgid "Add Run directive"
-msgstr "Add Run directive"
+msgstr "Dodaj dyrektywę Run"
 
 msgid "Add Runscript block"
-msgstr "Add Runscript block"
+msgstr "Dodaj dyrektywę Runscript"
 
 msgid "Add Console directive"
-msgstr "Add Console directive"
+msgstr "Dodaj dyrektywę Console"
 
 msgid "Add Stdout directive"
-msgstr "Add Stdout directive"
+msgstr "Dodaj dyrektywę Stdout"
 
 msgid "Add Stderr directive"
-msgstr "Add Stderr directive"
+msgstr "Dodaj dyrektywę Stderr"
 
 msgid "Add Syslog directive"
-msgstr "Add Syslog directive"
+msgstr "Dodaj dyrektywę Syslog"
 
 msgid "Add Catalog directive"
-msgstr "Add Catalog directive"
+msgstr "Dodaj dyrektywę Catalog"
 
 msgid "Add Director directive"
-msgstr "Add Director directive"
+msgstr "Dodaj dyrektywę Director"
 
 msgid "Add File directive"
-msgstr "Add File directive"
+msgstr "Dodaj dyrektywę File"
 
 msgid "Add Append directive"
-msgstr "Add Append directive"
+msgstr "Dodaj dyrektywę Append"
 
 msgid "Add Mail directive"
-msgstr "Add Mail directive"
+msgstr "Dodaj dyrektywę Mail"
 
 msgid "Add MailOnError directive"
-msgstr "Add MailOnError directive"
+msgstr "Dodaj dyrektywę MailOnError"
 
 msgid "Add MailOnSuccess directive"
-msgstr "Add MailOnSuccess directive"
+msgstr "Dodaj dyrektywę MailOnSuccess"
 
 msgid "Add Operator directive"
-msgstr "Add Operator directive"
+msgstr "Dodaj dyrektywę Operator"
 
 msgid "Enable Bacula messages log window:"
-msgstr "Enable Bacula messages log window:"
+msgstr "Włącz okno dzienników 'messages':"
 
 msgid "The messages log window enables to review Bacula logs in one place available from almost every part on the interface. To collect logs is used the bconsole 'messages' command. The messages log window is displayed after clicking on the envelope icon at the top right side of the interface. This function is enabled by default. If enabled, it is available only for users with the Administrator role assigned."
-msgstr "The messages log window enables to review Bacula logs in one place available from almost every part on the interface. To collect logs is used the bconsole 'messages' command. The messages log window is displayed after clicking on the envelope icon at the top right side of the interface. This function is enabled by default. If enabled, it is available only for users with the Administrator role assigned."
+msgstr "Okno dzienników 'messages' umożliwia przeglądanie dzienników Bacula w jednym miejscu dostępnym z prawie każdej części interfejsu. Do zbierania logów jest użyta komenda bconsole 'messages'. Okno dzienników 'messages' może zostać wyświetlone po kliknięciu w ikonę koperty w prawej górnej części interfejsu. Ta funkcja jest domyślnie załączona. Jeżeli jest załączona to jest dostępna jedynie dla użytkowników z przypisaną rolą Administrator."
 
 msgid "Copy configuration from:"
-msgstr "Copy configuration from:"
+msgstr "Kopiuj konfigurację z:"
+
+msgid "API basic users"
+msgstr "Użytkownicy API basic"
+
+msgid "API OAuth2 clients"
+msgstr "Klienci API OAuth2"
+
+msgid "The API basic users are configured on the API hosts and they are used to access the API hosts. Changes introduced on this page are directly done on currently used API host. You can use the basic user credentials to connect API hosts to the Baculum Web on the 'API hosts' tab. The basic user accounts are also possible to create directly in the panel of the Baculum API."
+msgstr "Użytkownicy API basic są konfigurowani na hostach API i są używani do dostępu do hostów API. Zmiany wprowadzone na tej stronie są bezpośrednio robione na obecnie użytym hoście API. Możesz użyć użytkowników API basic do podłączenia hostów API do Baculum Web w zakładce 'Hosty API'. Konta użytkowników API basic są również możliwe do stworzenia bezpośrednio w panelu Baculum API."
+
+msgid "Add new API basic user"
+msgstr "Dodaj nowego użytkownika API Basic"
+
+msgid "API basic username:"
+msgstr "Nazwa użytkownika API Basic:"
+
+msgid "API basic password:"
+msgstr "Hasło użytkownika API basic:"
+
+msgid "Retype password:"
+msgstr "Powtórz hasło:"
+
+msgid "Add API basic user account"
+msgstr "Dodaj konto użytkownika API basic"
+
+msgid "Edit API basic user account"
+msgstr "Edytuj konto użytkownika API basic"
+
+msgid "Please retype password."
+msgstr "Proszę powtórzyć hasło."
+
+msgid "Password must be longer than 4 chars and not longer than 60 chars."
+msgstr "Hasło musi mieć długość większą niż 4 znaki i nie być dłuższe niż 60 znaków."
+
+msgid "Invalid user. User may contain a-z A-Z 0-9 characters."
+msgstr "Niepoprawny użytkownik. Nazwa użytkownika może zawierać znaki: a-z A-Z 0-9."
+
+msgid "Dedicated Bconsole config"
+msgstr "Dedykowana konfiguracja Bconsole"
+
+msgid "Get existing basic user name:"
+msgstr "Pobierz nazwę istniejącego użytkownika:"
index 3f9bef2315764e004fb2b26f01c37270045ebfe4..66b4099f92b9dfa37b04e945c63f90be4349740a 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/pt/messages.mo and b/gui/baculum/protected/Web/Lang/pt/messages.mo differ
index f35c06402ccd94f1317ca976ac7d936cc3a722fc..e124aafec3ae41d616be32965c0d5398fd6ae312 100644 (file)
@@ -3042,8 +3042,8 @@ msgstr "Console ACL para usar no novo arquivo de configuração do Bconsole:"
 msgid "Director for Bconsole config:"
 msgstr "Configuração do director do Bconsole:"
 
-msgid "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the OAuth2 clients that can be used in API hosts. The assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
-msgstr "As ACLs de console ativam a definição de recursos disponíveis para os usuários. Os consoles são usados na configuração Bacula no lado de host da API. Existe a possibilidade de atribuir os consoles para os clientes OAuth2 que podem ser usados em hosts API. A relação de atribuição é: Console ACL -&gt; Cliente OAuth2 -&gt; Servidor de API -&gt; Conta de usuário."
+msgid "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the API basic users or to the OAuth2 clients. The assign relation for the basic users is: Console ACL -&gt; API basic user -&gt; API host -&gt; User account. For OAuth2 clients the assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
+msgstr "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the API basic users or to the OAuth2 clients. The assign relation for the basic users is: Console ACL -&gt; API basic user -&gt; API host -&gt; User account. For OAuth2 clients the assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
 
 msgid "The OAuth2 clients are configured on the API hosts. To create the OAuth2 clients from this page, you need to have an 'oauth2' scope in OAuth2 account related to your current admin user account. The OAuth2 client accounts are also possible to create directly in the panel of the Baculum API."
 msgstr "Os clientes OAuth2 estão configurados nos hosts API. Para criar os clientes OAuth2 a partir desta página, você precisa ter um escopo 'oauth2' na conta OAuth2 relacionada com sua conta de administrador atual. As contas de cliente OAuth2 também são possíveis de criar diretamente no painel da API Baculum."
@@ -3900,3 +3900,45 @@ msgstr "The messages log window enables to review Bacula logs in one place avail
 
 msgid "Copy configuration from:"
 msgstr "Copy configuration from:"
+
+msgid "API basic users"
+msgstr "API basic users"
+
+msgid "API OAuth2 clients"
+msgstr "API OAuth2 clients"
+
+msgid "The API basic users are configured on the API hosts and they are used to access the API hosts. Changes introduced on this page are directly done on currently used API host. You can use the basic user credentials to connect API hosts to the Baculum Web on the 'API hosts' tab. The basic user accounts are also possible to create directly in the panel of the Baculum API."
+msgstr "The API basic users are configured on the API hosts and they are used to access the API hosts. Changes introduced on this page are directly done on currently used API host. You can use the basic user credentials to connect API hosts to the Baculum Web on the 'API hosts' tab. The basic user accounts are also possible to create directly in the panel of the Baculum API."
+
+msgid "Add new API basic user"
+msgstr "Add new API basic user"
+
+msgid "API basic username:"
+msgstr "API basic username:"
+
+msgid "API basic password:"
+msgstr "API basic password:"
+
+msgid "Retype password:"
+msgstr "Retype password:"
+
+msgid "Add API basic user account"
+msgstr "Add API basic user account"
+
+msgid "Edit API basic user account"
+msgstr "Edit API basic user account"
+
+msgid "Please retype password."
+msgstr "Please retype password."
+
+msgid "Password must be longer than 4 chars and not longer than 60 chars."
+msgstr "Password must be longer than 4 chars and not longer than 60 chars."
+
+msgid "Invalid user. User may contain a-z A-Z 0-9 characters."
+msgstr "Invalid user. User may contain a-z A-Z 0-9 characters."
+
+msgid "Dedicated Bconsole config"
+msgstr "Dedicated Bconsole config"
+
+msgid "Get existing basic user name:"
+msgstr "Get existing basic user name:"
index c78b950260dc8d9850636ced7c864395950a7383..dab717d0124cf3f8889bafe08036631d00e928fe 100644 (file)
Binary files a/gui/baculum/protected/Web/Lang/ru/messages.mo and b/gui/baculum/protected/Web/Lang/ru/messages.mo differ
index c94092edfdf9f9ebbf4cb56cb09143c92b44b15d..ba7c9e9858ca839134e4e0a49156a3828acf5798 100644 (file)
@@ -3042,8 +3042,8 @@ msgstr "Консоль ACL для использования в новом ко
 msgid "Director for Bconsole config:"
 msgstr "Director для настройки Bconsol:"
 
-msgid "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the OAuth2 clients that can be used in API hosts. The assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
-msgstr "ACL консоли позволяют определять доступные ресурсы для пользователей. Консоли используются в конфигурации Bacula на стороне хоста API. Есть возможность назначить консоли клиентам OAuth2, которые могут быть использованы в хостах API. Связь назначений: консоль ACL -&gt; OAuth2 клиент -&gt; API хост -&gt; учетная запись пользователя."
+msgid "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the API basic users or to the OAuth2 clients. The assign relation for the basic users is: Console ACL -&gt; API basic user -&gt; API host -&gt; User account. For OAuth2 clients the assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
+msgstr "The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the API basic users or to the OAuth2 clients. The assign relation for the basic users is: Console ACL -&gt; API basic user -&gt; API host -&gt; User account. For OAuth2 clients the assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account."
 
 msgid "The OAuth2 clients are configured on the API hosts. To create the OAuth2 clients from this page, you need to have an 'oauth2' scope in OAuth2 account related to your current admin user account. The OAuth2 client accounts are also possible to create directly in the panel of the Baculum API."
 msgstr "Клиенты OAuth2 настроены на хост-серверах API. Чтобы создать OAuth2 клиентов с этой страницы, вам нужно иметь область действия 'oauth2' в учетной записи OAuth2, связанной с вашей текущей учетной записью администратора. Учетные записи клиентов OAuth2 также можно создать непосредственно в панели Baculum API."
@@ -3900,3 +3900,45 @@ msgstr "The messages log window enables to review Bacula logs in one place avail
 
 msgid "Copy configuration from:"
 msgstr "Copy configuration from:"
+
+msgid "API basic users"
+msgstr "API basic users"
+
+msgid "API OAuth2 clients"
+msgstr "API OAuth2 clients"
+
+msgid "The API basic users are configured on the API hosts and they are used to access the API hosts. Changes introduced on this page are directly done on currently used API host. You can use the basic user credentials to connect API hosts to the Baculum Web on the 'API hosts' tab. The basic user accounts are also possible to create directly in the panel of the Baculum API."
+msgstr "The API basic users are configured on the API hosts and they are used to access the API hosts. Changes introduced on this page are directly done on currently used API host. You can use the basic user credentials to connect API hosts to the Baculum Web on the 'API hosts' tab. The basic user accounts are also possible to create directly in the panel of the Baculum API."
+
+msgid "Add new API basic user"
+msgstr "Add new API basic user"
+
+msgid "API basic username:"
+msgstr "API basic username:"
+
+msgid "API basic password:"
+msgstr "API basic password:"
+
+msgid "Retype password:"
+msgstr "Retype password:"
+
+msgid "Add API basic user account"
+msgstr "Add API basic user account"
+
+msgid "Edit API basic user account"
+msgstr "Edit API basic user account"
+
+msgid "Please retype password."
+msgstr "Please retype password."
+
+msgid "Password must be longer than 4 chars and not longer than 60 chars."
+msgstr "Password must be longer than 4 chars and not longer than 60 chars."
+
+msgid "Invalid user. User may contain a-z A-Z 0-9 characters."
+msgstr "Invalid user. User may contain a-z A-Z 0-9 characters."
+
+msgid "Dedicated Bconsole config"
+msgstr "Dedicated Bconsole config"
+
+msgid "Get existing basic user name:"
+msgstr "Get existing basic user name:"
index f575827221f5145a7ba86fff0287bf6ae593bbdf..3860d21efdbcdab687a2e490d68f714c4a57537a 100644 (file)
@@ -11,7 +11,8 @@
                <button id="btn_user_list" type="button" class="w3-bar-item w3-button tab_btn" onclick="W3Tabs.open(this.id, 'user_list'); oUserList.table.responsive.recalc();"><%[ Users ]%></button>
                <button id="btn_role_list" type="button" class="w3-bar-item w3-button tab_btn" onclick="W3Tabs.open(this.id, 'role_list'); oRoleList.table.responsive.recalc();"><%[ Roles ]%></button>
                <button id="btn_console_list" type="button" class="w3-bar-item w3-button tab_btn<%=empty($_SESSION['dir']) ? ' hide': ''%>" onclick="W3Tabs.open(this.id, 'console_list'); oConsoleList.table.responsive.recalc();"><%[ Console ACLs ]%></button>
-               <button id="btn_oauth2_client_list" type="button" class="w3-bar-item w3-button tab_btn" onclick="W3Tabs.open(this.id, 'oauth2_client_list'); oOAuth2ClientList.table.responsive.recalc();"><%[ OAuth2 clients ]%></button>
+               <button id="btn_api_basic_user_list" type="button" class="w3-bar-item w3-button tab_btn" onclick="W3Tabs.open(this.id, 'api_basic_user_list'); oAPIBasicUserList.table.responsive.recalc();"><%[ API basic users ]%></button>
+               <button id="btn_oauth2_client_list" type="button" class="w3-bar-item w3-button tab_btn" onclick="W3Tabs.open(this.id, 'oauth2_client_list'); oOAuth2ClientList.table.responsive.recalc();"><%[ API OAuth2 clients ]%></button>
                <button id="btn_api_host_list" type="button" class="w3-bar-item w3-button tab_btn" onclick="W3Tabs.open(this.id, 'api_host_list'); oAPIHostList.table.responsive.recalc();"><%[ API hosts ]%></button>
        </div>
 
@@ -997,7 +998,7 @@ oLdapUserSecurity.init();
        </div>
        <div class="w3-container tab_item" id="user_list" style="display: none">
                <div class="w3-panel">
-                       <button type="button" id="add_user_btn" class="w3-button w3-green" onclick="oUsers.load_user_window()"><i class="fa fa-plus"></i> &nbsp;<%[ Add new user ]%></a>
+                       <button type="button" id="add_user_btn" class="w3-button w3-green" onclick="oUsers.load_user_window()"><i class="fa fa-plus"></i> &nbsp;<%[ Add new user ]%></button>
                </div>
                <table id="user_list_table" class="w3-table w3-striped w3-hoverable w3-white w3-margin-bottom selectable" style="width: 100%">
                        <thead>
@@ -1889,9 +1890,9 @@ var bulk_actions_output_id = '<%=$this->SourceTemplateControl->BulkActions->Bulk
        <com:TCallback ID="RemoveRolesAction" OnCallback="TemplateControl.removeRoles" />
        <com:Application.Web.Portlets.BulkActionsModal ID="BulkActions" />
        <div class="w3-container tab_item" id="console_list" style="display: none">
-               <p class="w3-hide-small"><%[ The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the OAuth2 clients that can be used in API hosts. The assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account. ]%></p>
+               <p class="w3-hide-small"><%[ The console ACLs enable to define available resources for users. The consoles are used in the Bacula configuration on the API host side. There is possible to assign the consoles to the API basic users or to the OAuth2 clients. The assign relation for the basic users is: Console ACL -&gt; API basic user -&gt; API host -&gt; User account. For OAuth2 clients the assign relation is: Console ACL -&gt; OAuth2 client -&gt; API host -&gt; User account. ]%></p>
                <div class="w3-panel">
-                       <button type="button" id="add_console_btn" class="w3-button w3-green" onclick="oConsoles.load_console_window()"><i class="fa fa-plus"></i> &nbsp;<%[ Add new console ]%></a>
+                       <button type="button" id="add_console_btn" class="w3-button w3-green" onclick="oConsoles.load_console_window()"><i class="fa fa-plus"></i> &nbsp;<%[ Add new console ]%></button>
                </div>
                <table id="console_list_table" class="w3-table w3-striped w3-hoverable w3-white w3-margin-bottom selectable" style="width: 100%">
                        <thead>
@@ -2193,10 +2194,420 @@ $(function() {
                </div>
                <com:TActiveHiddenField ID="ConsoleWindowType" />
        </div>
+       <div class="w3-container tab_item" id="api_basic_user_list" style="display: none;">
+               <p class="w3-hide-small"><%[ The API basic users are configured on the API hosts and they are used to access the API hosts. Changes introduced on this page are directly done on currently used API host. You can use the basic user credentials to connect API hosts to the Baculum Web on the 'API hosts' tab. The basic user accounts are also possible to create directly in the panel of the Baculum API. ]%></p>
+               <div id="api_basic_user_btn" class="w3-panel">
+                       <button type="button" id="add_api_basic_user_btn" class="w3-button w3-green" onclick="oAPIBasicUsers.load_api_basic_user_window()"><i class="fa fa-plus"></i> &nbsp;<%[ Add new API basic user ]%></button>
+               </div>
+               <table id="api_basic_user_list_table" class="w3-table w3-striped w3-hoverable w3-white w3-margin-bottom selectable" style="width: 100%">
+                       <thead>
+                               <tr>
+                                       <th></th>
+                                       <th><%[ Username ]%></th>
+                                       <th><%[ Dedicated Bconsole config ]%></th>
+                                       <th><%[ Actions ]%></th>
+                               </tr>
+                       </thead>
+                       <tbody id="api_basic_user_list_body"></tbody>
+                       <tfoot>
+                               <tr>
+                                       <th></th>
+                                       <th><%[ Username ]%></th>
+                                       <th><%[ Dedicated Bconsole config ]%></th>
+                                       <th><%[ Actions ]%></th>
+                               </tr>
+                       </tfoot>
+               </table>
+               <p id="api_basic_user_table_footer" class="info w3-hide-medium w3-hide-small"><%[ Tip: Use left-click to select table row. Use CTRL + left-click to multiple row selection. Use SHIFT + left-click to add a range of rows to selection. ]%></p>
+<com:TCallback ID="APIBasicUserList" OnCallback="TemplateControl.setAPIBasicUserList" />
+<com:TCallback ID="LoadAPIBasicUser" OnCallback="TemplateControl.loadAPIBasicUserWindow" />
+<com:TCallback ID="RemoveAPIBasicUsersAction" OnCallback="TemplateControl.removeAPIBasicUsers" />
+<script>
+var oAPIBasicUserList = {
+       ids: {
+               api_basic_user_list: 'api_basic_user_list_table'
+       },
+       actions: [
+               {
+                       action: 'remove',
+                       label: '<%[ Remove ]%>',
+                       value: 'username',
+                       callback: <%=$this->RemoveAPIBasicUsersAction->ActiveControl->Javascript%>
+               }
+       ],
+       data: [],
+       table: null,
+       table_toolbar: null,
+       init: function() {
+               if (!this.table) {
+                       this.set_table();
+                       this.set_bulk_actions();
+                       this.set_events();
+               } else {
+                       var page = this.table.page();
+                       this.table.clear().rows.add(this.data).draw();
+                       this.table.page(page).draw(false);
+                       this.table_toolbar.style.display = 'none';
+               }
+       },
+       set_events: function() {
+               document.getElementById(this.ids.api_basic_user_list).addEventListener('click', function(e) {
+                       $(function() {
+                               this.table_toolbar.style.display = this.table.rows({selected: true}).data().length > 0 ? '' : 'none';
+                       }.bind(this));
+               }.bind(this));
+       },
+       set_table: function() {
+               this.table = $('#' + this.ids.api_basic_user_list).DataTable({
+                       data: this.data,
+                       deferRender: true,
+                       dom: 'lB<"table_toolbar">frtip',
+                       stateSave: true,
+                       buttons: [
+                               'copy', 'csv', 'colvis'
+                       ],
+                       columns: [
+                               {
+                                       className: 'details-control',
+                                       orderable: false,
+                                       data: null,
+                                       defaultContent: '<button type="button" class="w3-button w3-blue"><i class="fa fa-angle-down"></i></button>'
+                               },
+                               {data: 'username'},
+                               {
+                                       data: 'bconsole_cfg_path',
+                                       render: function(data, type, row) {
+                                               var ret;
+                                               if (type == 'display') {
+                                                       ret = '';
+                                                       if (data) {
+                                                               var check = document.createElement('I');
+                                                               check.className = 'fas fa-check';
+                                                               ret = check.outerHTML;
+                                                       }
+                                               } else {
+                                                       ret = data;
+                                               }
+                                               return ret;
+                                       }
+                               },
+                               {
+                                       data: 'username',
+                                       render: function(data, type, row) {
+                                               var span = document.createElement('SPAN');
+                                               var edit_btn = document.createElement('BUTTON');
+                                               edit_btn.className = 'w3-button w3-green';
+                                               edit_btn.type = 'button';
+                                               var i = document.createElement('I');
+                                               i.className = 'fas fa-edit';
+                                               var label = document.createTextNode(' <%[ Edit ]%>');
+                                               edit_btn.appendChild(i);
+                                               edit_btn.innerHTML += '&nbsp';
+                                               edit_btn.appendChild(label);
+                                               edit_btn.setAttribute('onclick', 'oAPIBasicUsers.load_api_basic_user_window("' + data + '")');
+
+                                               span.appendChild(edit_btn);
+                                               return span.outerHTML;
+                                       }.bind(this)
+                               }
+                       ],
+                       responsive: {
+                               details: {
+                                       type: 'column'
+                               }
+                       },
+                       columnDefs: [{
+                               className: 'control',
+                               orderable: false,
+                               targets: 0
+                       },
+                       {
+                               className: 'action_col',
+                               orderable: false,
+                               targets: [ 3 ]
+                       },
+                       {
+                               className: "dt-center",
+                               targets: [ 2, 3 ]
+                       }],
+                       select: {
+                               style:    'os',
+                               selector: 'td:not(:last-child):not(:first-child)',
+                               blurable: false
+                       },
+                       order: [1, 'asc']
+               });
+       },
+       set_bulk_actions: function() {
+               this.table_toolbar = get_table_toolbar(this.table, this.actions, {
+                       actions: '<%[ Actions ]%>',
+                       ok: '<%[ OK ]%>'
+               });
+       }
+};
+
+var oAPIBasicUsers = {
+       window_mode: '',
+       load_api_basic_user_window: function(name) {
+               var title_add = document.getElementById('api_basic_user_window_title_add');
+               var title_edit = document.getElementById('api_basic_user_window_title_edit');
+               var username = document.getElementById('<%=$this->APIBasicUserUsername->ClientID%>');
+               var password = document.getElementById('<%=$this->APIBasicUserPassword->ClientID%>');
+               var retype_password = document.getElementById('<%=$this->RetypeAPIBasicUserPassword->ClientID%>');
+               var username_req = document.getElementById('api_basic_user_username_req');
+               var pass_req = document.getElementById('api_basic_user_password_req');
+               var retype_pass_req = document.getElementById('api_basic_user_retype_password_req');
+               var api_basic_user_win_type = document.getElementById('<%=$this->APIBasicUserWindowType->ClientID%>');
+               this.clear_api_basic_user_window();
+               var cb = <%=$this->LoadAPIBasicUser->ActiveControl->Javascript%>;
+               cb.setCallbackParameter(name);
+               cb.dispatch();
+               if (name) {
+                       // edit existing api basic user
+                       title_add.style.display = 'none';
+                       title_edit.style.display = 'inline-block';
+                       api_basic_user_win_type.value = 'edit';
+                       username.setAttribute('readonly', '');
+                       username_req.style.display = 'none';
+                       pass_req.style.display = 'none';
+                       retype_pass_req.style.display = 'none';
+                       this.window_mode = 'edit';
+               } else {
+                       // add new api basic user
+                       title_add.style.display = 'inline-block';
+                       title_edit.style.display = 'none';
+                       api_basic_user_win_type.value = 'add';
+                       username.removeAttribute('readonly');
+                       username_req.style.display = '';
+                       pass_req.style.display = '';
+                       retype_pass_req.style.display = '';
+                       this.window_mode = 'add';
+               }
+               password.type = retype_password.type = 'password';
+               document.getElementById('<%=$this->APIBasicUserBconsoleCreate->ClientID%>').checked = false;
+               document.getElementById('api_basic_user_console').style.display = 'none';
+               document.getElementById('api_basic_user_bconsole_cfg').style.display = '';
+               document.getElementById('api_basic_user_window').style.display = 'block';
+               document.getElementById('api_basic_user_error').style.display = 'none';
+               if (name) {
+                       password.focus();
+               } else {
+                       username.focus();
+               }
+       },
+       load_api_basic_user_list: function() {
+               var cb = <%=$this->APIBasicUserList->ActiveControl->Javascript%>;
+               cb.dispatch();
+       },
+       load_api_basic_user_list_cb: function(list, error) {
+               if (error == 0) {
+                       oAPIBasicUserList.data = list;
+                       oAPIBasicUserList.init();
+               }
+       },
+       clear_api_basic_user_window: function() {
+               [
+                       '<%=$this->APIBasicUserUsername->ClientID%>',
+                       '<%=$this->APIBasicUserPassword->ClientID%>',
+                       '<%=$this->RetypeAPIBasicUserPassword->ClientID%>',
+                       '<%=$this->APIBasicUserBconsoleCfgPath->ClientID%>',
+                       '<%=$this->APIBasicUserBconsoleCfgPath->ClientID%>',
+               ].forEach(function(id) {
+                       document.getElementById(id).value = '';
+               });
+       },
+       save_api_basic_user_cb: function(result) {
+               if (result.error == 0) {
+                       document.getElementById('api_basic_user_error').style.display = 'none';
+                       document.getElementById('api_basic_user_window').style.display = 'none';
+               } else {
+                       document.getElementById('api_basic_user_error').textContent = result.output;
+                       document.getElementById('api_basic_user_error').style.display = '';
+               }
+       }
+}
+
+$(function() {
+       oAPIBasicUsers.load_api_basic_user_list();
+});
+               </script>
+       </div>
+       <div id="api_basic_user_window" class="w3-modal">
+               <div class="w3-modal-content w3-animate-top w3-card-4">
+                       <header class="w3-container w3-teal">
+                               <span onclick="document.getElementById('api_basic_user_window').style.display = 'none';" class="w3-button w3-display-topright">&times;</span>
+                               <h2 id="api_basic_user_window_title_add" style="display: none"><%[ Add API basic user account ]%></h2>
+                               <h2 id="api_basic_user_window_title_edit" style="display: none"><%[ Edit API basic user account ]%></h2>
+                       </header>
+                       <div class="w3-container w3-margin-left w3-margin-right w3-margin-top w3-text-teal">
+                               <div class="w3-row directive_field">
+                                       <div class="w3-col w3-third"><com:TLabel ForControl="APIBasicUserUsername" Text="<%[ API basic username: ]%>" /></div>
+                                       <div class="w3-half">
+                                               <com:TActiveTextBox
+                                                       ID="APIBasicUserUsername"
+                                                       AutoPostBack="false"
+                                                       CausesValidation="false"
+                                                       CssClass="w3-input w3-border"
+                                               />
+                                               <com:TRequiredFieldValidator
+                                                       ValidationGroup="APIBasicUserGroup"
+                                                       ControlToValidate="APIBasicUserUsername"
+                                                       ErrorMessage="<%[ Please enter username. ]%>"
+                                                       ControlCssClass="field_invalid"
+                                                       Display="Dynamic"
+                                               />
+                                               <com:TRegularExpressionValidator
+                                                       ValidationGroup="APIBasicUserGroup"
+                                                       ControlToValidate="APIBasicUserUsername"
+                                                       ControlCssClass="field_invalid"
+                                                       RegularExpression="<%=BasicUserConfig::USER_PATTERN%>"
+                                                       ErrorMessage="<%[ Invalid user. User may contain a-z A-Z 0-9 characters. ]%>"
+                                                       Display="Dynamic"
+                                                       />
+                                       </div> &nbsp;<i id="api_basic_user_username_req" class="fa fa-asterisk w3-text-red opt_req"></i>
+                               </div>
+                               <div class="w3-row directive_field">
+                                       <div class="w3-col w3-third"><com:TLabel ForControl="APIBasicUserPassword" Text="<%[ API basic password: ]%>" /></div>
+                                       <div class="w3-half">
+                                               <com:TActiveTextBox
+                                                       ID="APIBasicUserPassword"
+                                                       CssClass="w3-input w3-border"
+                                                       CausesValidation="false"
+                                                       TextMode="Password"
+                                                       MaxLength="60"
+                                                       PersistPassword="true"
+                                               />
+                                               <com:TRequiredFieldValidator
+                                                       ValidationGroup="APIBasicUserGroup"
+                                                       ControlToValidate="APIBasicUserPassword"
+                                                       ErrorMessage="<%[ Please enter password. ]%>"
+                                                       ControlCssClass="field_invalid"
+                                                       Display="Dynamic"
+                                               >
+                                                       <prop:ClientSide.OnValidate>
+                                                               sender.enabled = (oAPIBasicUsers.window_mode == 'add');
+                                                       </prop:ClientSide.OnValidate>
+                                               </com:TRequiredFieldValidator>
+                                               <com:TRegularExpressionValidator
+                                                       ValidationGroup="APIBasicUserGroup"
+                                                       ControlToValidate="APIBasicUserPassword"
+                                                       ControlCssClass="field_invalid"
+                                                       RegularExpression="<%=BasicUserConfig::PASSWORD_PATTERN%>"
+                                                       ErrorMessage="<%[ Password must be longer than 4 chars and not longer than 60 chars. ]%>"
+                                                       Display="Dynamic"
+                                               />
+                                       </div> &nbsp;<i id="api_basic_user_password_req" class="fa fa-asterisk w3-text-red opt_req"></i>
+                                       &nbsp;<a href="javascript:void(0)" onclick="var el = document.getElementById('<%=$this->APIBasicUserPassword->ClientID%>'); el.type = el.type == 'text' ? 'password' : 'text'"><i class="fa fa-eye"></i></a>
+                                       &nbsp;<a href="javascript:void(0)" onclick="document.getElementById('<%=$this->APIBasicUserPassword->ClientID%>').value = document.getElementById('<%=$this->RetypeAPIBasicUserPassword->ClientID%>').value = get_random_string('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_~!@#$%^&*()_+}{|?[]\\/.,', 40); return false;" class="w3-text-black"><%[ generate ]%></a>
+                               </div>
+                               <div class="w3-row directive_field">
+                                       <div class="w3-col w3-third"><com:TLabel ForControl="RetypeAPIBasicUserPassword" Text="<%[ Retype password: ]%>" /></div>
+                                       <div class="w3-half">
+                                               <com:TActiveTextBox
+                                                       ID="RetypeAPIBasicUserPassword"
+                                                       CssClass="w3-input w3-border"
+                                                       TextMode="Password"
+                                                       MaxLength="60"
+                                                       PersistPassword="true"
+                                               />
+                                               <com:TRequiredFieldValidator
+                                                       ControlCssClass="field_invalid"
+                                                       Display="Dynamic"
+                                                       ControlToValidate="RetypeAPIBasicUserPassword"
+                                                       ValidationGroup="APIBasicUserGroup"
+                                                       ErrorMessage="<%[ Please retype password. ]%>"
+                                               >
+                                                       <prop:ClientSide.OnValidate>
+                                                               sender.enabled = (oAPIBasicUsers.window_mode == 'add');
+                                                       </prop:ClientSide.OnValidate>
+                                               </com:TRequiredFieldValidator>
+                                               <com:TRegularExpressionValidator
+                                                       ControlCssClass="field_invalid"
+                                                       Display="Dynamic"
+                                                       ControlToValidate="RetypeAPIBasicUserPassword"
+                                                       RegularExpression="<%=BasicUserConfig::PASSWORD_PATTERN%>"
+                                                       ValidationGroup="APIBasicUserGroup"
+                                                       ErrorMessage="<%[ Password must be longer than 4 chars and not longer than 60 chars. ]%>"
+                                               />
+                                               <com:TCompareValidator
+                                                       ControlCssClass="field_invalid"
+                                                       Display="Dynamic"
+                                                       ControlToValidate="RetypeAPIBasicUserPassword"
+                                                       ControlToCompare="APIBasicUserPassword"
+                                                       ValidationGroup="APIBasicUserGroup"
+                                                       Text="<%[ Passwords must be the same. ]%>"
+                                               />
+                                       </div> &nbsp;<i id="api_basic_user_retype_password_req" class="fa fa-asterisk w3-text-red opt_req"></i>
+                                       &nbsp;<a href="javascript:void(0)" onclick="var el = document.getElementById('<%=$this->RetypeAPIBasicUserPassword->ClientID%>'); el.type = el.type == 'text' ? 'password' : 'text'"><i class="fa fa-eye"></i></a>
+
+                               </div>
+                               <div class="w3-row directive_field" id="api_basic_user_bconsole_create">
+                                       <div class="w3-col w3-third"><com:TLabel ForControl="APIBasicUserBconsoleCreate" Text="<%[ Create dedicated Bconsole config file: ]%>" /></div>
+                                       <div class="w3-half">
+                                               <com:TActiveCheckBox
+                                                       ID="APIBasicUserBconsoleCreate"
+                                                       CssClass="w3-check"
+                                                       CausesValidation="false"
+                                                       Attributes.onclick="$('#api_basic_user_console').slideToggle('fast');$('#api_basic_user_bconsole_cfg').slideToggle('fast');"
+                                                       AutoPostBack="false"
+                                               />
+                                       </div>
+                               </div>
+                               <div id="api_basic_user_console" style="display: none">
+                                       <div class="w3-row directive_field">
+                                               <div class="w3-col w3-third"><com:TLabel ForControl="APIBasicUserConsole" Text="<%[ Console ACL to use in new Bconsole config file: ]%>" /></div>
+                                               <div class="w3-half">
+                                                       <com:TActiveDropDownList
+                                                               ID="APIBasicUserConsole"
+                                                               CssClass="w3-select w3-border"
+                                                               CausesValidation="false"
+                                                               AutoPostBack="false"
+                                                       />
+                                               </div>
+                                       </div>
+                                       <div class="w3-row directive_field">
+                                               <div class="w3-col w3-third"><com:TLabel ForControl="APIBasicUserDirector" Text="<%[ Director for Bconsole config: ]%>" /></div>
+                                               <div class="w3-half">
+                                                       <com:TActiveDropDownList
+                                                               ID="APIBasicUserDirector"
+                                                               CssClass="w3-select w3-border"
+                                                               CausesValidation="false"
+                                                               AutoPostBack="false"
+                                                       />
+                                               </div>
+                                       </div>
+                               </div>
+                               <div class="w3-row directive_field" id="api_basic_user_bconsole_cfg">
+                                       <div class="w3-col w3-third"><com:TLabel ForControl="APIBasicUserBconsoleCfgPath" Text="<%[ Dedicated Bconsole config file path: ]%>" /></div>
+                                       <div class="w3-half">
+                                               <com:TActiveTextBox
+                                                       ID="APIBasicUserBconsoleCfgPath"
+                                                       CssClass="w3-input w3-border"
+                                                       CausesValidation="false"
+                                               />
+                                       </div>
+                               </div>
+                       </div>
+                       <footer class="w3-container w3-center">
+                               <button type="button" class="w3-button w3-red" onclick="document.getElementById('api_basic_user_window').style.display = 'none';"><i class="fas fa-times"></i> &nbsp;<%[ Cancel ]%></button>
+                               <com:TActiveLinkButton
+                                       ID="APIBasicUserSave"
+                                       ValidationGroup="APIBasicUserGroup"
+                                       CausesValidation="true"
+                                       OnCallback="saveAPIBasicUser"
+                                       CssClass="w3-button w3-section w3-teal w3-padding"
+                               >
+                                       <i class="fa fa-save"></i> &nbsp;<%[ Save ]%>
+                               </com:TActiveLinkButton>
+                               <div id="api_basic_user_error" class="w3-red" style="display: none"></div>
+                       </footer>
+               </div>
+               <com:TActiveHiddenField ID="APIBasicUserWindowType" />
+       </div>
        <div class="w3-container tab_item" id="oauth2_client_list" style="display: none">
                <p class="w3-hide-small"><%[ The OAuth2 clients are configured on the API hosts. To create the OAuth2 clients from this page, you need to have an 'oauth2' scope in OAuth2 account related to your current admin user account. The OAuth2 client accounts are also possible to create directly in the panel of the Baculum API. ]%></p>
                <div id="oauth2_client_btn" class="w3-panel">
-                       <button type="button" id="add_oauth2_client_btn" class="w3-button w3-green" onclick="oOAuth2Clients.load_oauth2_client_window()"><i class="fa fa-plus"></i> &nbsp;<%[ Add new OAuth2 client ]%></a>
+                       <button type="button" id="add_oauth2_client_btn" class="w3-button w3-green" onclick="oOAuth2Clients.load_oauth2_client_window()"><i class="fa fa-plus"></i> &nbsp;<%[ Add new OAuth2 client ]%></button>
                </div>
                <table id="oauth2_client_list_table" class="w3-table w3-striped w3-hoverable w3-white w3-margin-bottom selectable" style="width: 100%">
                        <thead>
@@ -2619,7 +3030,7 @@ $(function() {
        <div class="w3-container tab_item" id="api_host_list" style="display: none">
                <p class="w3-hide-small"><%[ The API hosts define connection parameters to hosts with the Baculum API instances. You can create the API host connections dedicated for specific users by assigning API hosts to them on the Users tab. There is possible to create many API host connections to the same Baculum API instance. ]%></p>
                <div class="w3-panel">
-                       <button type="button" id="add_api_host_btn" class="w3-button w3-green" onclick="oAPIHosts.load_api_host_window()"><i class="fa fa-plus"></i> &nbsp;<%[ Add new API host ]%></a>
+                       <button type="button" id="add_api_host_btn" class="w3-button w3-green" onclick="oAPIHosts.load_api_host_window()"><i class="fa fa-plus"></i> &nbsp;<%[ Add new API host ]%></button>
                </div>
                <table id="api_host_list_table" class="w3-table w3-striped w3-hoverable w3-white w3-margin-bottom selectable" style="width: 100%">
                        <thead>
@@ -2958,6 +3369,24 @@ $(function() {
                                        </div>
                                </div>
                                <div id="configure_basic_auth" class="w3-margin-top" style="display: <%=($this->APIHostAuthBasic->Checked === true) ? '' : 'none';%>">
+                                       <div class="w3-row directive_field">
+                                               <div class="w3-col w3-third"><com:TLabel ForControl="APIHostBasicUserSettings" Text="<%[ Get existing basic user name: ]%>" /></div>
+                                               <div class="w3-col w3-third">
+                                                       <com:TActiveDropDownList
+                                                               ID="APIHostBasicUserSettings"
+                                                               CssClass="w3-select w3-border"
+                                                               CausesValidation="false"
+                                                               OnCallback="loadAPIBasicUserSettings"
+                                                       >
+                                                               <prop:ClientSide.OnLoading>
+                                                                       document.getElementById('api_host_basic_user_settings_loading').style.visibility = 'visible';
+                                                               </prop:ClientSide.OnLoading>
+                                                               <prop:ClientSide.OnComplete>
+                                                                       document.getElementById('api_host_basic_user_settings_loading').style.visibility = 'hidden';
+                                                               </prop:ClientSide.OnComplete>
+                                                       </com:TActiveDropDownList>
+                                               </div> &nbsp;<i id="api_host_basic_user_settings_loading" class="fas fa-sync w3-spin w3-text-black" style="visibility: hidden; margin: 10px 5px"></i>
+                                       </div>
                                        <div class="w3-row directive_field">
                                                <div class="w3-col w3-third"><com:TLabel ForControl="APIHostBasicLogin" Text="<%[ API Login: ]%>" /></div>
                                                <div class="w3-col w3-half">
index 07ab40b0aad380a584ff18a4943ea9e00a7e0ec8..b25fd4db6b7fab56fee49ec3c62daedd6e89130f 100644 (file)
@@ -40,6 +40,7 @@ Prado::using('System.Web.UI.WebControls.TValidationSummary');
 Prado::using('Application.Common.Class.Crypto');
 Prado::using('Application.Common.Class.Ldap');
 Prado::using('Application.Common.Class.OAuth2');
+Prado::using('Application.Common.Class.BasicUserConfig');
 Prado::using('Application.Web.Class.BaculumWebPage');
 Prado::using('Application.Web.Portlets.BaculaConfigResources');
 
@@ -1350,6 +1351,151 @@ class Security extends BaculumWebPage {
                $this->getCallbackClient()->callClientFunction('oBaculaConfigSection.show_sections', [true]);
        }
 
+       /**
+        * Set and load API basic user list.
+        *
+        * @param TCallback $sender sender object
+        * @param TCallbackEventParameter callback parameter
+        * @return none
+        */
+       public function setAPIBasicUserList($sender, $param) {
+               $basic_users = $this->getModule('api')->get(['basic', 'users']);
+               $this->getCallbackClient()->callClientFunction('oAPIBasicUsers.load_api_basic_user_list_cb', [
+                       $basic_users->output,
+                       $basic_users->error
+               ]);
+
+               if ($basic_users->error === 0) {
+                       $usernames = ['' => ''];
+                       for ($i = 0; $i < count($basic_users->output); $i++) {
+                               $usernames[$basic_users->output[$i]->username] = $basic_users->output[$i]->username;
+                       }
+                       $this->APIHostBasicUserSettings->DataSource = $usernames;
+                       $this->APIHostBasicUserSettings->dataBind();
+               }
+       }
+
+       /**
+        * Load data in API basic user modal window.
+        *
+        * @param TCallback $sender sender object
+        * @param TCallbackEventParameter $param callback parameter
+        * @return none
+        */
+       public function loadAPIBasicUserWindow($sender, $param) {
+               $username = $param->getCallbackParameter();
+               if (!empty($username)) {
+                       $basic_user_cfg = $this->getModule('api')->get(['basic', 'users', $username]);
+                       if ($basic_user_cfg->error === 0 && is_object($basic_user_cfg->output)) {
+                               // It is done only for existing basic user accounts
+                               $this->APIBasicUserUsername->Text = $basic_user_cfg->output->username;
+                               $this->APIBasicUserBconsoleCfgPath->Text = $basic_user_cfg->output->bconsole_cfg_path;
+                       }
+               }
+               $this->loadAPIBasicUserConsole(null, null);
+
+               $dirs = $this->getModule('api')->get(['config', 'bcons', 'Director']);
+               $dir_names = [];
+               if ($dirs->error == 0) {
+                       for ($i = 0; $i < count($dirs->output); $i++) {
+                               $dir_names[$dirs->output[$i]->Director->Name] = $dirs->output[$i]->Director->Name;
+                       }
+               }
+               $this->APIBasicUserDirector->DataSource = $dir_names;
+               $this->APIBasicUserDirector->dataBind();
+       }
+
+       public function loadAPIBasicUserConsole($sender, $param) {
+               $cons = $this->getModule('api')->get(['config', 'dir', 'Console']);
+               $console = ['' => ''];
+               if ($cons->error == 0) {
+                       for ($i = 0; $i < count($cons->output); $i++) {
+                               $console[$cons->output[$i]->Console->Name] = $cons->output[$i]->Console->Name;
+                       }
+               }
+               $this->APIBasicUserConsole->DataSource = $console;
+               $this->APIBasicUserConsole->dataBind();
+       }
+
+       /**
+        * Save API basic user config.
+        * It works both for new basic users and for edited basic users.
+        * Saves values from modal popup.
+        *
+        * @param TCallback $sender sender object
+        * @param TCallbackEventParameter $param callback parameter
+        * @return none
+        */
+       public function saveAPIBasicUser($sender, $param) {
+               $username = $this->APIBasicUserUsername->Text;
+               $cfg = [];
+               $cfg['username'] = $username;
+               $cfg['password'] = $this->APIBasicUserPassword->Text;
+               $cfg['bconsole_cfg_path'] = $this->APIBasicUserBconsoleCfgPath->Text;
+               if ($this->APIBasicUserBconsoleCreate->Checked) {
+                       $cfg['console'] = $this->APIBasicUserConsole->SelectedValue;
+                       $cfg['director'] = $this->APIBasicUserDirector->SelectedValue;
+               }
+
+               $win_type = $this->APIBasicUserWindowType->Value;
+               $result = (object)['error' => -1];
+               if ($win_type === self::TYPE_ADD_WINDOW) {
+                       $result = $this->getModule('api')->create(['basic', 'users', $username], $cfg);
+               } elseif ($win_type === self::TYPE_EDIT_WINDOW) {
+                       $result = $this->getModule('api')->set(['basic', 'users', $username], $cfg);
+               }
+
+               if ($result->error === 0) {
+                       // Refresh API basic user list
+                       $this->setAPIBasicUserList(null, null);
+               }
+               $this->getCallbackClient()->callClientFunction('oAPIBasicUsers.save_api_basic_user_cb', [
+                       $result
+               ]);
+       }
+
+       /**
+        * Remove API basic users action.
+        * Here is possible to remove one basic user or many.
+        * This action is linked with table bulk actions.
+        *
+        * @param TCallback $sender sender object
+        * @param TCallbackEventParameter $param callback parameter
+        * @return none
+        */
+       public function removeAPIBasicUsers($sender, $param) {
+               $usernames = explode('|', $param->getCallbackParameter());
+               for ($i = 0; $i < count($usernames); $i++) {
+                       $result = $this->getModule('api')->remove(['basic', 'users', $usernames[$i]]);
+                       if ($result->error !== 0) {
+                               break;
+                       }
+               }
+
+               if (count($usernames) > 0) {
+                       // Refresh API basic user list
+                       $this->setAPIBasicUserList(null, null);
+               }
+       }
+
+       /**
+        * Set and load basic user settings to API host modal window.
+        *
+        * @param TActiveDropDownList $sender sender object
+        * @param TCallbackEventParameter callback parameter
+        * @return none
+        */
+       public function loadAPIBasicUserSettings($sender, $param) {
+               $username = $this->APIHostBasicUserSettings->SelectedValue;
+               if (!empty($username)) {
+                       $host = $this->APIHostSettings->SelectedValue ?: null;
+                       $basic_cfg = $this->getModule('api')->get(['basic', 'users', $username], $host);
+                       if ($basic_cfg->error === 0 && is_object($basic_cfg->output)) {
+                               $this->APIHostBasicLogin->Text = $basic_cfg->output->username;
+                       }
+               }
+       }
+
        /**
         * Set and load OAuth2 client list.
         *