3 * FusionForge system users integration
5 * Copyright 2004, Christian Bayle
7 * This file is part of FusionForge.
9 * FusionForge is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published
11 * by the Free Software Foundation; either version 2 of the License,
12 * or (at your option) any later version.
14 * FusionForge is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with FusionForge; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
25 require_once $gfcommon.'include/Error.class.php';
27 class System extends Error {
38 * sysUseUnixName() - Check if user/group used the unix_name
40 * @param string The unix_name to check
41 * @returns true if used/false is free
44 function sysUseUnixName($unix_name) {
49 * User management functions
53 * sysCheckUser() - Check for the existence of a user
55 * @param int The user ID of the user to check
56 * @returns true on success/false on error
59 function sysCheckUser($user_id) {
60 $user =& user_get_object($user_id);
69 * sysCreateUser() - Create a user
71 * @param int The user ID of the user to create
72 * @returns The return status
75 function sysCreateUser($user_id) {
76 $user = &user_get_object($user_id);
85 * sysCheckCreateUser() - Check that a user has been created
87 * @param int The ID of the user to check
88 * @returns true on success/false on error
91 function sysCheckCreateUser($user_id) {
92 return $this->sysCreateUser($user_id);
96 * sysCheckCreateGroup() - Check that a group has been created
98 * @param int The ID of the user to check
99 * @returns true on success/false on error
102 function sysCheckCreateGroup($user_id) {
103 return $this->sysCreateGroup($user_id);
107 * sysRemoveUser() - Remove a user
109 * @param int The user ID of the user to remove
110 * @returns true on success/false on failure
113 function sysRemoveUser($user_id) {
118 * sysUserSetAttribute() - Set an attribute for a user
120 * @param int The user ID
121 * @param string The attribute to set
122 * @param string The new value of the attribute
123 * @returns true on success/false on error
126 function sysUserSetAttribute($user_id,$attr,$value) {
131 * Group management functions
135 * sysCheckGroup() - Check for the existence of a group
137 * @param int The ID of the group to check
138 * @returns true on success/false on error
141 function sysCheckGroup($group_id) {
146 * sysCreateGroup() - Create a group
148 * @param int The ID of the group to create
149 * @returns true on success/false on error
152 function sysCreateGroup($group_id) {
157 * sysRemoveGroup() - Remove a group
159 * @param int The ID of the group to remove
160 * @returns true on success/false on error
163 function sysRemoveGroup($group_id) {
168 * sysGroupAddUser() - Add a user to a group
170 * @param int The ID of the group two which the user will be added
171 * @param int The ID of the user to add
172 * @param bool Only add this user to CVS
173 * @returns true on success/false on error
176 function sysGroupAddUser($group_id,$user_id,$cvs_only=0) {
181 * sysGroupRemoveUser() - Remove a user from a group
183 * @param int The ID of the group from which to remove the user
184 * @param int The ID of the user to remove
185 * @param bool Only remove user from CVS group
186 * @returns true on success/false on error
189 function sysGroupRemoveUser($group_id,$user_id,$cvs_only=0) {
193 * sysGroupUpdateUser() - Remove a user from a group
195 * @param int The ID of the group from which to remove the user
196 * @param int The ID of the user to remove
197 * @param bool Only remove user from CVS group
198 * @returns true on success/false on error
201 function sysGroupUpdateUser($group_id,$user_id,$cvs_only=0) {
202 $this->sysGroupRemoveUser($group_id,$user_id,$cvs_only=0);
203 $this->sysGroupAddUser($group_id,$user_id,$cvs_only=0);
210 // c-file-style: "bsd"