3 * FusionForge system users integration
5 * Copyright 2004, Christian Bayle
7 * This file is part of FusionForge. FusionForge is free software;
8 * you can redistribute it and/or modify it under the terms of the
9 * GNU General Public License as published by the Free Software
10 * Foundation; either version 2 of the Licence, or (at your option)
13 * FusionForge is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 require_once $gfcommon.'include/Error.class.php';
25 class System extends Error {
36 * sysUseUnixName() - Check if user/group used the unix_name
38 * @param string $unix_name The unix_name to check
39 * @return bool true if used/false is free
42 function sysUseUnixName($unix_name) {
47 * User management functions
51 * sysCheckUser() - Check for the existence of a user
53 * @param int $user_id The user ID of the user to check
54 * @return bool true on success/false on error
57 function sysCheckUser($user_id) {
58 $user =& user_get_object($user_id);
67 * sysCreateUser() - Create a user
69 * @param int $user_id The user ID of the user to create
70 * @return bool The return status
73 function sysCreateUser($user_id) {
74 $user = &user_get_object($user_id);
83 * sysCheckCreateUser() - Check that a user has been created
85 * @param int $user_id The ID of the user to check
86 * @return bool true on success/false on error
89 function sysCheckCreateUser($user_id) {
90 return $this->sysCreateUser($user_id);
94 * sysCheckCreateGroup() - Check that a group has been created
96 * @param int $user_id The ID of the user to check
97 * @return bool true on success/false on error
100 function sysCheckCreateGroup($user_id) {
101 return $this->sysCreateGroup($user_id);
105 * sysRemoveUser() - Remove a user
107 * @param int $user_id The user ID of the user to remove
108 * @return bool true on success/false on failure
111 function sysRemoveUser($user_id) {
116 * sysUserSetAttribute() - Set an attribute for a user
118 * @param int $user_id The user ID
119 * @param string $attr The attribute to set
120 * @param string $value The new value of the attribute
121 * @return bool true on success/false on error
124 function sysUserSetAttribute($user_id, $attr, $value) {
129 * Group management functions
133 * sysCheckGroup() - Check for the existence of a group
135 * @param int The ID of the group to check
136 * @returns true on success/false on error
139 function sysCheckGroup($group_id) {
144 * sysCreateGroup() - Create a group
146 * @param int The ID of the group to create
147 * @returns true on success/false on error
150 function sysCreateGroup($group_id) {
155 * sysRemoveGroup() - Remove a group
157 * @param int The ID of the group to remove
158 * @returns true on success/false on error
161 function sysRemoveGroup($group_id) {
166 * sysGroupCheckUser() - Sync forge permissions with system permissions for that user/group
168 * @param int The ID of the group two which the user will be added
169 * @param int The ID of the user to add
170 * @returns true on success/false on error
173 function sysGroupCheckUser($group_id, $user_id) {
178 * sysGroupAddUser() - Add a user to a group
180 * @param int The ID of the group two which the user will be added
181 * @param int The ID of the user to add
182 * @param bool Only add this user to CVS
183 * @returns true on success/false on error
186 function sysGroupAddUser($group_id, $user_id, $cvs_only = 0) {
191 * sysGroupRemoveUser() - Remove a user from a group
193 * @param int The ID of the group from which to remove the user
194 * @param int The ID of the user to remove
195 * @param bool Only remove user from CVS group
196 * @returns true on success/false on error
199 function sysGroupRemoveUser($group_id, $user_id, $cvs_only = 0) {
204 * sysGroupUpdateUser() - Remove a user from a group
206 * @param int The ID of the group from which to remove the user
207 * @param int The ID of the user to remove
208 * @param bool Only remove user from CVS group
209 * @returns true on success/false on error
212 function sysGroupUpdateUser($group_id, $user_id, $cvs_only = 0) {
213 $this->sysGroupRemoveUser($group_id, $user_id, $cvs_only);
214 $this->sysGroupAddUser($group_id, $user_id, $cvs_only);
221 // c-file-style: "bsd"