/** * Get a generic user * * @param String $sessionKey The project admin session hash * @param Integer $groupId The Project id where the User Group is defined * * @return UserInfo */ public function getProjectGenericUser($sessionKey, $groupId) { if (!$this->isRequesterAdmin($sessionKey, $groupId)) { throw new SoapFault('3201', 'Permission denied: need to be project admin.'); } $user = $this->generic_user_factory->fetch($groupId); if (!$user) { throw new SoapFault('3106', "Generic User does not exist"); } return user_to_soap($user->getId(), $user, $this->userManager->getCurrentUser()); }
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ require_once 'pre.php'; require_once 'common/user/GenericUserFactory.class.php'; require_once 'common/include/CSRFSynchronizerToken.class.php'; // Valid group id $valid_groupid = new Valid_GroupId(); $valid_groupid->required(); if (!$request->valid($valid_groupid)) { exit_error($Language->getText('project_admin_index', 'invalid_p'), $Language->getText('project_admin_index', 'p_not_found')); } $group_id = $request->get('group_id'); //must be a project admin session_require(array('group' => $group_id, 'admin_flags' => 'A')); $user_manager = UserManager::instance(); $generic_user_factory = new GenericUserFactory($user_manager, ProjectManager::instance(), new GenericUserDao()); $generic_user = $generic_user_factory->fetch($group_id); $redirect_url = '/project/admin/editgenericmember.php?group_id=' . (int) $group_id; $token = new CSRFSynchronizerToken($redirect_url); if ($request->get('update_generic_user')) { $token->check(); $password = $request->getValidated('password'); $email = $request->getValidated('email'); if ($password) { $generic_user->setPassword($password); } $generic_user->setEmail($email); if ($user_manager->updateDb($generic_user)) { $GLOBALS['Response']->addFeedback('info', $Language->getText('project_admin', 'generic_member_updated')); } else { $GLOBALS['Response']->addFeedback('warning', $Language->getText('project_admin', 'generic_member_not_changed'));
* but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Tuleap. If not, see <http://www.gnu.org/licenses/>. */ require_once 'pre.php'; require_once 'www/admin/admin_utils.php'; require_once 'common/include/CSRFSynchronizerToken.class.php'; require_once 'common/user/GenericUserFactory.class.php'; session_require_site_admin(); $fake_project = new Project(array('group_id' => -1, 'unix_group_name' => $Language->getText('admin_generic_user', 'unix_name_template'), 'group_name' => $Language->getText('admin_generic_user', 'name_template'))); $sample_project = new Project(array('group_id' => -1, 'unix_group_name' => 'gpig', 'group_name' => 'Guinea Pig')); $fake_user = new PFUser(array()); $generic_user_factory = new GenericUserFactory(UserManager::instance(), ProjectManager::instance(), new GenericUserDao()); $fake_generic_user = $generic_user_factory->getGenericUser($fake_project, $fake_user); $sample_generic_user = $generic_user_factory->getGenericUser($sample_project, $fake_user); $name_css = ''; $valid_username_format = new Valid_GenericUserNameSuffix(''); if (!$valid_username_format->validate($sample_generic_user->getUnixName())) { $GLOBALS['Response']->addFeedback(Feedback::ERROR, $Language->getText('admin_generic_user', 'invalid_suffix', array(GenericUserFactory::CONFIG_KEY_SUFFIX))); $name_css = 'highlight'; } site_admin_header(array('title' => $Language->getText('admin_generic_user', 'title'))); echo '<h2>' . $Language->getText('admin_generic_user', 'title') . '</h2> <p>' . $Language->getText('admin_generic_user', 'help') . '</p> <p>' . $Language->getText('admin_generic_user', 'help_update', array(GenericUserFactory::CONFIG_KEY_SUFFIX)) . '</p> <p> <label><b>' . $Language->getText('account_register', 'realname') . '</b>:</label><br /> ' . $fake_generic_user->getRealName() . '