UserManagement
TsgcHTMLComponent_UserManagement — tabela administracji użytkownikami z awatarem, rolami, statusem, wyszukiwaniem i rozwijanym menu akcji dla każdego wiersza, w Delphi, C++ Builder i .NET.
TsgcHTMLComponent_UserManagement — tabela administracji użytkownikami z awatarem, rolami, statusem, wyszukiwaniem i rozwijanym menu akcji dla każdego wiersza, w Delphi, C++ Builder i .NET.
Dodawaj użytkowników za pomocą AddUser (lub powiąż zestaw danych), wybierz, które kolumny i akcje wiersza mają być dostępne, a następnie odczytaj właściwość HTML.
TsgcHTMLComponent_UserManagement
Pasek narzędzi + tabela Bootstrap 5 + rozwijane menu akcji
Delphi, C++ Builder, .NET
Wywołaj AddUser dla każdego konta, odczytaj HTML dla tabeli, a następnie autoryzuj i zastosuj każdą akcję odebraną kanałem WebSocket za pomocą ProcessUserAction.
uses
sgcHTML_Component_UserManagement;
var
oUsers: TsgcHTMLComponent_UserManagement;
oUser: TsgcHTMLUser;
begin
oUsers := TsgcHTMLComponent_UserManagement.Create(nil);
try
oUsers.TableID := 'users';
oUsers.AllowImpersonate := True;
oUsers.AllowDelete := True;
oUser := oUsers.AddUser('u1', 'ana.torres', 'ana@example.com');
oUser.DisplayName := 'Ana Torres';
oUser.Roles := 'admin,editor';
oUser.Status := usActive;
oUser.LastLogin := '2026-07-15 09:12';
oUsers.AddUser('u2', 'marc.bell', 'marc@example.com').Status := usInvited;
WebModule.Response := oUsers.HTML; // toolbar + table + inline script
finally
oUsers.Free;
end;
end;
// Server-side handler for an action received over WebSockets.
// ALWAYS verify the acting user is authorized before applying it:
oUsers.ProcessUserAction('userDisable', 'u2');
// includes: sgcHTML_Component_UserManagement.hpp
TsgcHTMLComponent_UserManagement *oUsers = new TsgcHTMLComponent_UserManagement(NULL);
try
{
oUsers->TableID = "users";
oUsers->AllowImpersonate = true;
oUsers->AllowDelete = true;
TsgcHTMLUser *oUser = oUsers->AddUser("u1", "ana.torres", "ana@example.com");
oUser->DisplayName = "Ana Torres";
oUser->Roles = "admin,editor";
oUser->Status = usActive;
oUser->LastLogin = "2026-07-15 09:12";
oUsers->AddUser("u2", "marc.bell", "marc@example.com")->Status = usInvited;
String html = oUsers->HTML; // toolbar + table + inline script
// Server-side handler for an action received over WebSockets:
oUsers->ProcessUserAction("userDisable", "u2");
}
__finally
{
delete oUsers;
}
using esegece.sgcWebSockets;
var users = new TsgcHTMLComponent_UserManagement();
users.TableID = "users";
users.AllowImpersonate = true;
users.AllowDelete = true;
var user = users.AddUser("u1", "ana.torres", "ana@example.com");
user.DisplayName = "Ana Torres";
user.Roles = "admin,editor";
user.Status = TsgcHTMLUserStatus.usActive;
user.LastLogin = "2026-07-15 09:12";
users.AddUser("u2", "marc.bell", "marc@example.com").Status = TsgcHTMLUserStatus.usInvited;
string html = users.HTML; // toolbar + table + inline script
// Server-side handler for an action received over WebSockets.
// ALWAYS verify the acting user is authorized before applying it:
users.ProcessUserAction("userDisable", "u2");
Składniki, po które sięgasz najczęściej.
AddUser(aId, aUserName, aEmail) dodaje wiersz i zwraca TsgcHTMLUser, dzięki czemu możesz ustawić DisplayName, Roles, Status, LastLogin i AvatarURL.
LoadFromDataSet(aDataSet, aIdField, aUserNameField, aEmailField, aRolesField, aStatusField) wypełnia tabelę i zapamiętuje mapowanie na potrzeby późniejszych odświeżeń.
TsgcHTMLUserStatus — usActive, usInvited, usSuspended, usDisabled — renderowany jako kolorowa plakietka; Roles to lista rozdzielana przecinkami, renderowana jako plakietki.
Rozwijane menu każdego wiersza oferuje Edytuj / Wyłącz-Włącz / Resetuj hasło; AllowImpersonate i AllowDelete dodają bardziej wrażliwe akcje.
ShowSearch, ShowAddButton (z AddCaption / SearchPlaceholder) sterują paskiem narzędzi; ShowRoles, ShowStatus, ShowLastLogin, ShowActions i PageSize sterują tabelą.
Każda akcja jest przesyłana od klienta do serwera jako JSON (i wyzwala sgcUserManagement:action). ProcessUserAction może zostać uruchomiony dopiero po zweryfikowaniu przez hosta, że działający użytkownik jest upoważniony do tej akcji.
| Pomoc onlinePełna dokumentacja API i przewodnik użytkowania tego komponentu. | Otwórz | |
| Wszystkie komponenty sgcHTMLPrzejrzyj pełną matrycę funkcji 80+ komponentów. | Otwórz | |
| Pobierz bezpłatną wersję próbną30-dniowa wersja próbna zawiera projekty demonstracyjne 60.HTML. | Otwórz | |
| CennikLicencje Single, Team i Site z pełnym kodem źródłowym. | Otwórz |