+<%init>
+my $Classes = RT::Classes->new($session{'CurrentUser'});
+$Classes->LimitToEnabled();
+
+# This is a COUNT(), which doesn't apply ACLs; as such, we don't display
+# the warning if there are classes, but the user can't see them.
+my $classes_configured = $Classes->Count;
+
+# ->Next applies SeeClass, but we also want to check CreateArticle
+my @classes;
+while (my $class = $Classes->Next) {
+ push @classes, $class if $class->CurrentUserHasRight("CreateArticle");
+}
+
+# If there is only one, redirect to it
+MaybeRedirectForResults(
+ Path => "/Articles/Article/Edit.html",
+ Force => 1,
+ Arguments => { Class => $classes[0]->id },
+) if @classes == 1;
+</%init>