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 
25 class Group;
26 class User;
27 
31 {
32  public:
35  {
36  return m_Instance;
37  }
38 
40  void initialise();
41 
43  User *getUser(size_t id);
45  User *getUser(String name);
46 
48  Group *getGroup(size_t id);
50  Group *getGroup(String name);
51 
52  private:
54  UserManager();
55  ~UserManager();
56  UserManager(const UserManager &);
57  UserManager &operator=(const UserManager &);
58 
59  void initialiseUsers();
60  void initialiseGroups();
61  void addUser(
62  size_t uid, String username, String fullName, String group, String home,
63  String shell, String password);
64  void addGroup(size_t gid, String name);
65 
70 
71  static UserManager m_Instance;
72 };
Tree< size_t, User * > m_Users
Definition: UserManager.h:67
Tree< size_t, Group * > m_Groups
Definition: UserManager.h:69
Definition: String.h:49
Definition: User.h:32
static UserManager & instance()
Definition: UserManager.h:34
Definition: Group.h:32