Files
DP44/docs/ai/DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/Users.md
2026-04-17 14:55:32 -04:00

5.0 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/Users/IUIItems.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/Users/ITagAware.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/Users/Tags.cs
DataPRO/Modules/PreviousDBVersions/Version57/DatabaseExport/Users/User.cs
2026-04-17T15:54:08.207380+00:00 zai-org/GLM-5-FP8 1 3cdbf9b023e772e8

Documentation: DatabaseExport Users Module (Version 57)

1. Purpose

This module provides the user management subsystem for the DatabaseExport namespace, handling user identity, roles, permissions, visibility settings, and tag associations. It implements a tag caching system for efficient tag lookups, supports serialization of user data for XML storage, and manages per-user permissions on UI items. The module is part of a legacy database version (Version 57) and contains abstractions for database-backed user entities with timestamp and tagging capabilities.


2. Public Interface

IUIItems (Interface)

File: IUIItems.cs

string GetName();
  • Returns the name of a UI item. Implementers provide a string identifier used for permission and visibility lookups in the User class.

TagAwareBase (Abstract Class)

File: ITagAware.cs Inherits from: DbTimeStampBase

Properties:

byte[] TagsBlobBytes { get; set; }
int[] TagIDs { get; set; }
  • TagsBlobBytes: Converts TagIDs to/from a byte array (4 bytes per int). The setter silently catches exceptions during conversion.
  • TagIDs: Backed by _tagIDs, defaults to empty array. Setter null-coalesces to empty array.

Methods:

string GetTagsCommaSeperatedString();
virtual string[] GetTagsArray();
  • GetTagsCommaSeperatedString(): Returns comma-separated string of tag text by delegating to GetTagsArray().
  • GetTagsArray(): Returns string array of tag text by calling Tags.GetTagTextFromIDs(TagIDs).

Tags (Class)

File: Tags.cs

Nested Class Tag:

public const int INVALID_ID = -1;
int ID { get; set; }
string Text { get; set; }
bool IsObsolete { get; set; }
  • Implements ICloneable. Constructor from DataRow reads fields via DbOperations.Tags.TagFields enum. Copy constructor available.

Static Properties:

static Tags TagsInstance { get; }
  • Singleton accessor, lazily instantiated.

Static Methods:

static string GetTagTextFromID(int tagID);
static string[] GetTagTextFromIDs(int[] tagID);
  • GetTagTextFromID(int): Returns tag text for a valid ID (> 0 and not Tag.INVALID_ID), or null if invalid/not found.
  • GetTagTextFromIDs(int[]): Returns array of tag texts, skipping invalid IDs and null/whitespace results.

Constructor:

Tags(); // Initializes _tagsLookup and calls UpdateList()

User (Class)

File: User.cs Inherits from: TagAwareBase

Nested Enums:

public enum DefaultRoles { Administrator = 0, PowerUser = 1, User = 2, Guest = 3 }
public enum UserPermissionLevels { Deny = 0, Read = 1, ReadAndExecute = 2, Edit = 3, Admin = 4 }
public enum Tags { User, Role, Version, LastModified, LastModifiedBy, Name, UserName, Password, LocalOnly, Permissions, Visibility, Id }
public enum XmlFields { ID, UserName, DisplayName, Password, IUIItemPermissions, IUIItemVisibility, Role, LastModified, LastModifiedBy, Version, LocalOnly, UserTags }

Constants:

private const string DEFAULT_LAST_MODIFIED_BY = "---";
private const string DEFAULT_ADMIN_USERNAME = "Admin";
private const string DEFAULT_GUEST_USERNAME = "Guest";
private const string DEFAULT_POWERUSER_USERNAME = "PowerUser";
private const string DEFAULT_USER_USERNAME = "User";
private const int INVALID_ID = -1;

Properties:

bool IsADefaultUser { get; }
string Name { get; set; }
string UserName { get; set; }
int Id { get; set; }
DefaultRoles Role { get; set; }
int Version { get; set; }
DateTime LastModified { get; set; }
string LastModifiedBy { get; set; }
bool LocalOnly { get; set; }
  • Role setter throws NotSupportedException if user is a default user and role changes.
  • All setters use SetProperty(ref field, value, Tags.EnumName.ToString()).

Constructor:

User(DataRow row);
  • Populates user from DbOperations.Users.UserFields columns.

Methods:

override ConstraintHelper[] GetConstraints();
override string LookupTable { get; }
string GetPermissionSerialized();
static string GetDefaultUserName(DefaultRoles role);
string GetVisibilitySerialized();
Dictionary<string, string> GetValues();
  • GetConstraints(): Returns single constraint on UserName column.
  • LookupTable: Returns DbOperations.Users.USERS_TABLE.
  • GetPermissionSerialized(): Returns "ItemName=PermissionValue,..." string from _tabPermissions dictionary.
  • GetDefaultUserName(DefaultRoles): Maps role enum to default username string; throws NotSupportedException for unknown roles.
  • `Get