From 72b41e2f711198ad9baa846e7ba37f6e070cedb0 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 30 Jan 2026 08:10:48 +0100 Subject: chore: ddk: Fix build on nebuild for C++ DDK. chore: kernel: Tweaks and internal improvements. Signed-off-by: Amlal El Mahrouss --- src/kernel/KernelKit/UserMgr.h | 97 ++---------------------------------------- 1 file changed, 3 insertions(+), 94 deletions(-) (limited to 'src/kernel/KernelKit/UserMgr.h') diff --git a/src/kernel/KernelKit/UserMgr.h b/src/kernel/KernelKit/UserMgr.h index e568dd45..66f5a129 100644 --- a/src/kernel/KernelKit/UserMgr.h +++ b/src/kernel/KernelKit/UserMgr.h @@ -1,101 +1,10 @@ -// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org) +// Copyright 2026, Amlal El Mahrouss (amlal@nekernel.org) // Licensed under the Apache License, Version 2.0 (see LICENSE file) // Official repository: https://github.com/nekernel-org/nekernel #ifndef KERNELKIT_USERMGR_H #define KERNELKIT_USERMGR_H -/* ======================================== +#include - Revision History: - - 04/03/25: Set users directory as /users/ instead of /usr/ - - ======================================== */ - -#include -#include -#include -#include - -///! We got the MGMT, STD (%s format) and GUEST users, -///! all are used to make authorized operations. -#define kMgmtUser "NEKERNEL/MGMT/%s" -#define kGuestUser "NEKERNEL/GUEST/%s" -#define kStdUser "NEKERNEL/STD/%s" - -#define kUsersDir "/users/" - -#define kMaxUserNameLen (256U) -#define kMaxUserTokenLen (256U) - -namespace Kernel { - -class User; - -enum struct UserRingKind : Int32 { - kRingInvalid = 0, - kRingStdUser = 444, - kRingSuperUser = 666, - kRingGuestUser = 777, - kRingCount = 3, -}; - -using UserPublicKey = Char*; -using UserPublicKeyType = Char; - -/// @brief System User class. -class User final { - public: - User() = delete; - - User(const Int32& sel, const Char* username); - User(const UserRingKind& kind, const Char* username); - - ~User(); - - public: - NE_COPY_DEFAULT(User) - - public: - bool operator==(const User& lhs); - bool operator!=(const User& lhs); - - public: - /// @brief Get software ring - const UserRingKind& Ring(); - - /// @brief Get user name - Char* Name(); - - /// @brief Is he a standard user? - Bool IsStdUser(); - - /// @brief Is she a super user? - Bool IsSuperUser(); - - /// @brief Saves a password from the public key. - Bool Save(const UserPublicKey password); - - /// @brief Checks if a password matches the **password**. - /// @param password the password to check. - Bool Login(const UserPublicKey password); - - private: - UserRingKind mUserRing{UserRingKind::kRingStdUser}; - Char mUserName[kMaxUserNameLen] = {0}; - UInt64 mUserFNV{0UL}; -}; - -/// \brief Alias for user ptr. -using UserPtr = User*; - -/// \brief Current running user. -inline UserPtr kCurrentUser = nullptr; - -/// \brief Super user. -inline UserPtr kRootUser = nullptr; - -} // namespace Kernel - -#endif /* ifndef KERNELKIT_USERMGR_H */ +#endif \ No newline at end of file -- cgit v1.2.3