2 package IkiWiki::Receive;
9 my $user=(getpwuid(exists $ENV{CALLER_UID} ? $ENV{CALLER_UID} : $<))[0];
10 if (! defined $user) {
11 error("cannot determine username for $<");
18 return ! ref $config{untrusted_committers} ||
19 ! grep { $_ eq $user } @{$config{untrusted_committers}};
23 # Test for commits from untrusted committers in the wrapper, to
24 # avoid starting ikiwiki proper at all for trusted commits.
34 error(sprintf(gettext("cannot determine id of untrusted committer %s"), $_));
37 } @{$config{untrusted_committers}}).
43 * Consume all stdin before exiting, as git may
44 * otherwise be unhappy. */
46 while (read(0, &buf, 256) != 0) {}
49 asprintf(&s, "CALLER_UID=%i", u);
62 # Dummy up a cgi environment to use when calling check_canedit
68 # And dummy up a session object.
70 my $session=IkiWiki::cgi_getsession($cgi);
71 $session->param("name", getuser());
72 # Make sure whatever user was authed is in the
74 require IkiWiki::UserInfo;
75 if (! IkiWiki::userinfo_get($session->param("name"), "regdate")) {
76 IkiWiki::userinfo_setall($session->param("name"), {
80 }) || error("failed adding user");
83 IkiWiki::check_canchange(
86 changes => [IkiWiki::rcs_receive()]