summaryrefslogtreecommitdiffhomepage
path: root/Kernel/Sources/User.cxx
diff options
context:
space:
mode:
authorAmlal <amlalelmahrouss@icloud.com>2024-07-28 16:11:46 +0000
committerAmlal <amlalelmahrouss@icloud.com>2024-07-28 16:11:46 +0000
commitc4023005e029ae092dad2689564c490580dd5c28 (patch)
tree3080ba07a6b552bf3d7591574cf69b2a3c8fd0fd /Kernel/Sources/User.cxx
parent8c8822fff78f9ff9cd640271da9b3634c4c2f97f (diff)
parent4db57a2d646b1538783a0675b38bada7a0f903ae (diff)
Merged in MHR-36 (pull request #17)
MHR-36
Diffstat (limited to 'Kernel/Sources/User.cxx')
-rw-r--r--Kernel/Sources/User.cxx64
1 files changed, 64 insertions, 0 deletions
diff --git a/Kernel/Sources/User.cxx b/Kernel/Sources/User.cxx
new file mode 100644
index 00000000..68d0d5be
--- /dev/null
+++ b/Kernel/Sources/User.cxx
@@ -0,0 +1,64 @@
+/*
+ * ========================================================
+ *
+ * Kernel
+ * Copyright ZKA Technologies, all rights reserved.
+ *
+ * File: User.cpp
+ * Purpose: Permission selectors.
+ *
+ * ========================================================
+ */
+
+#include <KernelKit/User.hxx>
+#include <NewKit/KernelCheck.hpp>
+
+/// bugs 0
+
+namespace Kernel
+{
+ User::User(const Int32& sel, const Char* userName)
+ : fRing((RingKind)sel)
+ {
+ MUST_PASS(sel >= 0);
+ this->fUserName += userName;
+ }
+
+ User::User(const RingKind& ringKind, const Char* userName)
+ : fRing(ringKind)
+ {
+ this->fUserName += userName;
+ }
+
+ User::~User() = default;
+
+ bool User::operator==(const User& lhs)
+ {
+ return lhs.fRing == this->fRing;
+ }
+
+ bool User::operator!=(const User& lhs)
+ {
+ return lhs.fRing != this->fRing;
+ }
+
+ const StringView User::Name() noexcept
+ {
+ return this->fUserName;
+ }
+
+ const RingKind& User::Ring() noexcept
+ {
+ return this->fRing;
+ }
+
+ Bool User::IsStdUser() noexcept
+ {
+ return this->Ring() == RingKind::kRingStdUser;
+ }
+
+ Bool User::IsSuperUser() noexcept
+ {
+ return this->Ring() == RingKind::kRingSuperUser;
+ }
+} // namespace Kernel