summaryrefslogtreecommitdiff
path: root/doc/plugins/lockedit/discussion.mdwn
blob: b058b2b07f0e14dc19cdd4993db88938f8c2b6c0 (plain)

This plugin not only locks pages but ensures too a user is logged in. This seems to me redundant with signedit. I propose :

sub canedit ($$) {
	my $page=shift;
	my $cgi=shift;
	my $session=shift;

	my $user=$session->param("name");
	return undef if defined $user && IkiWiki::is_admin($user);

	if (defined $config{locked_pages} && length $config{locked_pages} &&
	    pagespec_match($page, $config{locked_pages},
		    user => $session->param("name"),
		    ip => $ENV{REMOTE_ADDR},
	    )) {
		return sprintf(gettext("%s is locked and cannot be edited"),
			htmllink("", "", $page, noimageinline => 1));
	}

	return undef;
}