Example #1
0
            $user->RevokeSegmentAccess();

            $access = array();
            if (!is_array($function_params['segments'])) {
                $access[$function_params['segments']] = 1;
            } else {
                foreach ($function_params['segments'] as $segmentid) {
                    $access[$segmentid] = 1;
                }
            }

            $user->GrantSegmentAccess($access);
        }

        if ($editMode) {
            $result = $user->Save(true);
            if (!$result) {
                SendResponse(false, 'Unable to update user');
                exit();
            }

            // Run any customized modifications we need to. Will load xml-api-editexistinguser.php if it exists
            $file = IEM_PATH . '/custom/xml-api-editexistinguser.php';
            if (is_readable($file)) {
                include $file;
            }

            SendResponse(true, $user->userid);
            exit();
        } else {
            // Create user