The Pedigree Project 0.1
UserManager.h
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#include "pedigree/kernel/compiler.h"
21#include "pedigree/kernel/processor/types.h"
22#include "pedigree/kernel/utilities/String.h"
23#include "pedigree/kernel/utilities/Tree.h"
24
25class Group;
26class User;
27
29class EXPORTED_PUBLIC UserManager {
30 public:
33 return m_Instance;
34 }
35
37 void initialise();
38
40 User* getUser(size_t id);
42 User* getUser(String name);
43
45 Group* getGroup(size_t id);
47 Group* getGroup(String name);
48
49 private:
54 UserManager& operator=(const UserManager&);
55
56 bool initialiseUsers();
57 bool initialiseGroups();
58 bool initialiseMemberships();
59 void addUser(size_t uid, String username, String fullName, size_t group, String home,
60 String shell);
61 void addGroup(size_t gid, String name);
62
67
68 static UserManager m_Instance;
69};
Definition Group.h:32
A key/value dictionary.
Definition Tree.h:33
Tree< size_t, User * > m_Users
Definition UserManager.h:64
Tree< size_t, Group * > m_Groups
Definition UserManager.h:66
static UserManager & instance()
Definition UserManager.h:32
Definition User.h:32