summaryrefslogtreecommitdiff
path: root/Source/Kernel/UserManager
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-10-23 17:28:25 +0200
committerAlexis211 <alexis211@gmail.com>2009-10-23 17:28:25 +0200
commitf0556ed7f051fb101dc68752526696365bf79a11 (patch)
tree61345fbadbf76c6f12b36b48a9dfadd744f6cbbd /Source/Kernel/UserManager
parentdf179c18baab4b5d85a283924fb23dfee7ea7fdb (diff)
downloadMelon-f0556ed7f051fb101dc68752526696365bf79a11.tar.gz
Melon-f0556ed7f051fb101dc68752526696365bf79a11.zip
More work on syscalls and shell
Diffstat (limited to 'Source/Kernel/UserManager')
-rw-r--r--Source/Kernel/UserManager/User.class.h3
-rw-r--r--Source/Kernel/UserManager/Usr.ns.h3
2 files changed, 6 insertions, 0 deletions
diff --git a/Source/Kernel/UserManager/User.class.h b/Source/Kernel/UserManager/User.class.h
index 1ad55f4..ae02281 100644
--- a/Source/Kernel/UserManager/User.class.h
+++ b/Source/Kernel/UserManager/User.class.h
@@ -28,16 +28,19 @@ class User {
u32int getUid() { return m_uid; }
Group* getGroup() { return m_group; }
bool isInGroup(u32int gid) {
+ if (m_group->getGid() == gid) return true;
for (u32int i = 0; i < m_extraGroups.size(); i++)
if (m_extraGroups[i]->getGid() == gid) return true;
return false;
}
bool isInGroup(String name) {
+ if (m_group->getName() == name) return true;
for (u32int i = 0; i < m_extraGroups.size(); i++)
if (m_extraGroups[i]->getName() == name) return true;
return false;
}
bool isInGroup(Group* g) {
+ if (g == m_group) return true;
for (u32int i = 0; i < m_extraGroups.size(); i++)
if (m_extraGroups[i] == g) return true;
return false;
diff --git a/Source/Kernel/UserManager/Usr.ns.h b/Source/Kernel/UserManager/Usr.ns.h
index 36ee2cb..ba41d34 100644
--- a/Source/Kernel/UserManager/Usr.ns.h
+++ b/Source/Kernel/UserManager/Usr.ns.h
@@ -5,6 +5,9 @@
class Group;
class User;
+#define INGRP(group) Usr::user()->isInGroup(group)
+#define ISROOT Usr::user()->isInGroup("root")
+
namespace Usr {
void load(); //Loads users into memory, from /System/Configuration/{Users,Groups}
void save(); //Saves config from mem to filesystem