22 require_once(
"$MODDIR/lib/php/common-cli.php");
26 error_reporting(E_NOTICE & E_STRICT);
28 $Usage =
"Usage: " . basename($argv[0]) .
" [options] 29 --username = user name 31 --groupname = a group the user belongs to (default active group) 32 --uploadId = id of upload 33 --destgroup = group which will become admin of the upload\n";
37 $opts = getopt(
"hc:", array(
"username:",
"groupname:",
"uploadId:",
"password:",
"destgroup:"));
38 if (array_key_exists(
'h', $opts)) {
43 if (!array_key_exists(
"uploadId", $opts)) {
44 echo
"no uploadId supplied\n";
47 if (!array_key_exists(
"destgroup", $opts)) {
48 echo
"no destgroup supplied\n";
51 $uploadId = $opts[
"uploadId"];
53 $user = array_key_exists(
"username", $opts) ? $opts[
"username"] :
'';
54 $group = array_key_exists(
"groupname", $opts) ? $opts[
"groupname"] :
'';
55 $passwd = array_key_exists(
"password", $opts) ? $opts[
"password"] : null;
59 $userId = $SysConf[
'auth'][
'UserId'];
60 $groupId = $SysConf[
'auth'][
'GroupId'];
63 $userDao = $GLOBALS[
'container']->get(
"dao.user");
64 $destGroupId = $userDao->getGroupIdByName($opts[
"destgroup"]);
67 $uploadpermDao = $GLOBALS[
'container']->get(
"dao.upload.permission");
68 $uploadpermDao->makeAccessibleToGroup($uploadId, $destGroupId);
account_check(&$user, &$passwd, &$group="")
check if this account is correct
cli_Init()
Initialize the fossology environment for CLI use. This routine loads the plugins so they can be use b...