mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-11-10 04:29 am

[dw-free] migrate LJ::get_cap / $u->get_cap to specific user methods

[commit: http://hg.dwscoalition.org/dw-free/rev/7587b5545368]

http://bugs.dwscoalition.org/show_bug.cgi?id=1894

Migrate more uses of LJ::get_cap to LJ::User->methods.

Patch by [staff profile] denise.

Files modified:
  • cgi-bin/DW/Setting/XPostAccounts.pm
  • cgi-bin/DW/User/Edges/WatchTrust.pm
  • cgi-bin/LJ/Links.pm
  • cgi-bin/LJ/NotificationInbox.pm
  • cgi-bin/LJ/S2.pm
  • cgi-bin/LJ/S2/EntryPage.pm
  • cgi-bin/LJ/Setting/Interests.pm
  • cgi-bin/LJ/Subscription.pm
  • cgi-bin/LJ/Tags.pm
  • cgi-bin/LJ/Talk.pm
  • cgi-bin/LJ/User.pm
  • cgi-bin/LJ/Widget/CreateAccountProfile.pm
  • cgi-bin/LJ/Widget/FriendInterests.pm
  • cgi-bin/LJ/Widget/LinksList.pm
  • cgi-bin/ljprotocol.pl
  • htdocs/customize/advanced/layers.bml
  • htdocs/customize/advanced/styles.bml
  • htdocs/delcomment.bml
  • htdocs/editpics.bml
  • htdocs/inbox/compose.bml
  • htdocs/interests.bml
  • htdocs/login.bml
  • htdocs/manage/domain.bml
  • htdocs/manage/emailpost.bml
  • htdocs/manage/externalaccount.bml
  • htdocs/manage/invites.bml
  • htdocs/manage/profile/index.bml
  • htdocs/manage/subscriptions/user.bml
  • htdocs/manage/tags.bml
  • htdocs/talkmulti.bml
  • htdocs/talkpost.bml
  • htdocs/talkscreen.bml
  • htdocs/tools/endpoints/esn_subs.bml
  • htdocs/tools/recent_comments.bml
  • htdocs/update.bml
--------------------------------------------------------------------------------
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/DW/Setting/XPostAccounts.pm
--- a/cgi-bin/DW/Setting/XPostAccounts.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/DW/Setting/XPostAccounts.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -95,7 +95,7 @@ sub option {
     $ret .= "</table>\n";
 
     # show account usage.
-    my $max_accounts = LJ::get_cap($u, "xpost_accounts");
+    my $max_accounts = $u->count_max_xpost_accounts;
     $ret .= "<p style='text-align: center;'>" . $class->ml('setting.xpost.message.usage', { current => scalar @accounts, max => $max_accounts });
 
     # add account
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/DW/User/Edges/WatchTrust.pm
--- a/cgi-bin/DW/User/Edges/WatchTrust.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/DW/User/Edges/WatchTrust.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -1057,7 +1057,7 @@ sub _can_add_wt_edge {
 
     # have they reached their friend limit?
     my $fr_count = $opts->{'numfriends'} || $u->friend_uids;
-    my $maxfriends = $u->get_cap('maxfriends');
+    my $maxfriends = $u->count_maxfriends;
     if ($fr_count >= $maxfriends) {
         $$err = "You have reached your limit of $maxfriends friends.";
         return 0;
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/LJ/Links.pm
--- a/cgi-bin/LJ/Links.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/LJ/Links.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -74,7 +74,7 @@ sub save_linkobj
 
     # only save allowed number of links
     my $numlinks = @$linkobj;
-    my $caplinks = LJ::get_cap($u, "userlinks");
+    my $caplinks = $u->count_max_userlinks;
     $numlinks = $caplinks if $numlinks > $caplinks;
 
     # build insert query
@@ -116,7 +116,7 @@ sub make_linkobj_from_form
 
     # find number of links allowed
     my $numlinks = $post->{'numlinks'};
-    my $caplinks = LJ::get_cap($u, "userlinks");
+    my $caplinks = $u->count_max_userlinks;
     $numlinks = $caplinks if $numlinks > $caplinks;
 
     foreach my $num (sort { $post->{"link_${a}_ordernum"} <=>
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/LJ/NotificationInbox.pm
--- a/cgi-bin/LJ/NotificationInbox.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/LJ/NotificationInbox.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -368,7 +368,7 @@ sub enqueue {
     my $u = $self->u or die "No user";
 
     # if over the max, delete the oldest notification
-    my $max = $u->get_cap('inbox_max');
+    my $max = $u->count_inbox_max;
     my $skip = $max - 1; # number to skip to get to max
     if ($max && $self->count >= $max) {
 
@@ -517,7 +517,7 @@ sub can_add_bookmark {
 sub can_add_bookmark {
     my ($self, $count) = @_;
 
-    my $max = $self->u->get_cap('bookmark_max');
+    my $max = $self->u->count_bookmark_max;
     $count = $count || 1;
     my $bookmark_count = scalar $self->bookmark_items;
 
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/LJ/S2.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -1949,7 +1949,7 @@ sub Entry_from_entryobj
         read_url => $readurl,
         post_url => $posturl,
         count => $replycount,
-        maxcomments => ( $replycount >= LJ::get_cap( $u, 'maxcomments' ) ) ? 1 : 0,
+        maxcomments => ( $replycount >= $u->count_maxcomments ) ? 1 : 0,
         enabled => $comments_enabled,
         screened => $has_screened,
         show_readlink => $comments_enabled && ( $replycount || $has_screened ),
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/LJ/S2/EntryPage.pm
--- a/cgi-bin/LJ/S2/EntryPage.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/LJ/S2/EntryPage.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -462,7 +462,7 @@ sub EntryPage_entry
         'read_url' => $readurl,
         'post_url' => $posturl,
         'count' => $replycount,
-        'maxcomments' => ($replycount >= LJ::get_cap($u, 'maxcomments')) ? 1 : 0,
+        'maxcomments' => ( $replycount >= $u->count_maxcomments ) ? 1 : 0,
         'enabled' => ($viewall || ($u->{'opt_showtalklinks'} eq "Y" && !$entry->prop("opt_nocomments"))) ? 1 : 0,
         'screened' => ($entry->prop("hasscreened") && $remote && LJ::can_manage($remote, $u)) ? 1 : 0,
     });
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/LJ/Setting/Interests.pm
--- a/cgi-bin/LJ/Setting/Interests.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/LJ/Setting/Interests.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -36,7 +36,7 @@ sub error_check {
     my @interrors = ();
 
     # Don't bother validating the interests if there are already too many
-    my $maxinterests = $u->get_cap( 'interests' );
+    my $maxinterests = $u->count_max_interests;
 
     if ($intcount > $maxinterests) {
         $class->errors("interests" => LJ::Lang::ml('error.interest.excessive2', { intcount => $intcount, maxinterests => $maxinterests }));
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/LJ/Subscription.pm
--- a/cgi-bin/LJ/Subscription.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/LJ/Subscription.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -592,7 +592,7 @@ sub as_html { $_[0]->as_string }
 sub as_html { $_[0]->as_string }
 sub as_string {
     my $self = shift;
-    my $max = $self->field('u')->get_cap('subscriptions');
+    my $max = $self->field('u')->count_max_subscriptions;
     return 'The subscription "' . $self->field('subscr')->as_html . '" was not saved because you have' .
         " reached your limit of $max active subscriptions. Subscriptions need to be deactivated before more can be added.";
 }
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/LJ/Tags.pm
--- a/cgi-bin/LJ/Tags.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/LJ/Tags.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -779,7 +779,7 @@ sub update_logtags {
 
     # at this point we have enough information to determine if they're going to break their
     # max, so let's do that so we can bail early enough to prevent a rollback operation
-    my $max = $opts->{ignore_max} ? 0 : $u->get_cap('tags_max');
+    my $max = $opts->{ignore_max} ? 0 : $u->count_tags_max;
     if (@to_create && $max && $max > 0) {
         my $total = scalar(keys %$utags) + scalar(@to_create);
         return $err->(LJ::Lang::ml('taglib.error.toomany', { max => $max })) if $total > $max;
@@ -1050,7 +1050,7 @@ sub create_usertag {
         unless LJ::Tags::is_valid_tagstring($kw, $tags);
 
     # check to ensure we don't exceed the max of tags
-    my $max = $opts->{ignore_max} ? 0 : $u->get_cap('tags_max');
+    my $max = $opts->{ignore_max} ? 0 : $u->count_tags_max;
     if ($max && $max > 0) {
         my $cur = scalar(keys %{ LJ::Tags::get_usertags($u) || {} });
         return $err->(LJ::Lang::ml('taglib.error.toomany', { max => $max }))
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/LJ/Talk.pm
--- a/cgi-bin/LJ/Talk.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/LJ/Talk.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -2433,7 +2433,7 @@ sub mail_comments {
     # them, so it shouldn't matter.)
     my $u = $comment->{u};
     LJ::load_user_props($u, 'opt_getselfemail') if $u;
-    if ($u && $u->{'opt_getselfemail'} && LJ::get_cap($u, 'getselfemail')
+    if ($u && $u->{'opt_getselfemail'} && $u->can_get_self_email
         && !$u->gets_notified(journal => $journalu, arg1 => $ditemid, arg2 => $comment->{talkid})) {
         my $part;
 
@@ -2837,7 +2837,7 @@ sub init {
 
     my $journalu = $init->{'journalu'};
     return $bmlerr->('talk.error.nojournal') unless $journalu;
-    return $err->($LJ::MSG_READONLY_USER) if LJ::get_cap($journalu, "readonly");
+    return $err->($LJ::MSG_READONLY_USER) if $journalu->is_readonly;
 
     return $err->("Account is locked, unable to post or edit a comment.") if $journalu->is_locked;
 
@@ -3306,7 +3306,7 @@ sub require_captcha_test {
     ## 4. Test preliminary limit on comment.
     ## We must check it before we will allow owner to pass.
     ##
-    if (LJ::Talk::get_replycount($journal, $ditemid >> 8) >= LJ::get_cap($journal, 'maxcomments-before-captcha')) {
+    if ( LJ::Talk::get_replycount($journal, $ditemid >> 8) >= $journal->count_maxcomments_before_captcha ) {
         return 1;
     }
 
@@ -3575,7 +3575,7 @@ sub over_maxcomments {
     return 0 unless $journalu && $jitemid;
 
     my $count = LJ::Talk::get_replycount($journalu, $jitemid);
-    return ($count >= LJ::get_cap($journalu, 'maxcomments')) ? 1 : 0;
+    return ( $count >= $journalu->count_maxcomments ) ? 1 : 0;
 }
 
 # more anti-spammer rate limiting.  returns 1 if rate is okay, 0 if too fast.
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/LJ/User.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -425,7 +425,7 @@ sub is_memorial {
 
 sub is_readonly {
     my $u = shift;
-    return $u->statusvis eq 'O';
+    return $u->statusvis eq 'O' || $u->get_cap( 'readonly' );
 }
 
 
@@ -1842,6 +1842,10 @@ sub can_find_similar {
     return $_[0]->get_cap( 'findsim' ) ? 1 : 0;
 }
 
+sub can_get_comments {
+    return $_[0]->get_cap( 'get_comments' ) ? 1 : 0;
+}
+
 sub can_get_self_email {
     return $_[0]->get_cap( 'getselfemail' ) ? 1 : 0;
 }
@@ -1850,12 +1854,24 @@ sub can_have_email_alias {
     return $_[0]->get_cap( 'useremail' ) ? 1 : 0;
 }
 
+sub can_leave_comments {
+    return $_[0]->get_cap( 'leave_comments' ) ? 1 : 0;
+}
+
 sub can_map_domains {
     return $_[0]->get_cap( 'domainmap' ) ? 1 : 0;
 }
 
 sub can_notify_weblogs {
     return $_[0]->get_cap( 'weblogscom' ) ? 1 : 0;
+}
+
+sub can_post {
+    return $_[0]->get_cap( 'can_post' ) ? 1 : 0;
+}
+
+sub can_post_disabled {
+    return $_[0]->get_cap( 'disable_can_post' ) ? 1 : 0;
 }
 
 sub can_show_location {
@@ -1906,6 +1922,10 @@ sub can_track_pollvotes {
 
 sub can_track_thread {
     return $_[0]->get_cap( 'track_thread' ) ? 1 : 0;
+}
+
+sub can_use_checkfriends {
+    return $_[0]->get_cap( 'checkfriends' ) ? 1 : 0;
 }
 
 sub can_use_daily_readpage {
@@ -2013,6 +2033,74 @@ sub control_strip_display {
     }
 
     return $ret ? $ret : 0;
+}
+
+sub count_bookmark_max {
+    return $_[0]->get_cap( 'bookmark_max' );
+}
+
+sub count_inbox_max {
+    return $_[0]->get_cap( 'inbox_max' );
+}
+
+sub count_maxcomments {
+    return $_[0]->get_cap( 'maxcomments' );
+}
+
+sub count_maxcomments_before_captcha {
+    return $_[0]->get_cap( 'maxcomments-before-captcha' );
+}
+
+sub count_maxfriends {
+    return $_[0]->get_cap( 'friends' );
+}
+
+sub count_max_interests {
+    return $_[0]->get_cap( 'interests' );
+}
+
+sub count_max_mod_queue {
+    return $_[0]->get_cap( 'mod_queue' );
+}
+
+sub count_max_mod_queue_per_poster {
+    return $_[0]->get_cap( 'mod_queue_per_poster' );
+}
+
+sub count_max_subscriptions {
+    return $_[0]->get_cap( 'subscriptions' );
+}
+
+sub count_max_userlinks {
+    return $_[0]->get_cap( 'userlinks' );
+}
+
+sub count_max_userpics {
+    return $_[0]->get_cap( 'userpics' );
+}
+
+sub count_max_xpost_accounts {
+    return $_[0]->get_cap( 'xpost_accounts' );
+}
+
+sub count_recent_comments_display {
+    return $_[0]->get_cap( 'tools_recent_comments_display' );
+}
+
+sub count_s2layersmax {
+    return $_[0]->get_cap( 's2layersmax' );
+}
+
+sub count_s2stylesmax {
+    return $_[0]->get_cap( 's2stylesmax' );
+}
+
+sub count_tags_max {
+    return $_[0]->get_cap( 'tags_max' );
+}
+
+sub count_usermessage_length {
+    return $_[0]->get_cap( 'usermessage_length' );
 }
 
 
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/LJ/Widget/CreateAccountProfile.pm
--- a/cgi-bin/LJ/Widget/CreateAccountProfile.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/LJ/Widget/CreateAccountProfile.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -192,7 +192,7 @@ sub handle_post {
 
     # count interests
     my $intcount = scalar @ints;
-    my $maxinterests = $u->get_cap( 'interests' );
+    my $maxinterests = $u->count_max_interests;
 
     $from_post{errors}->{interests} = LJ::Lang::ml('error.interest.excessive2', { intcount => $intcount, maxinterests => $maxinterests })
         if $intcount > $maxinterests;
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/LJ/Widget/FriendInterests.pm
--- a/cgi-bin/LJ/Widget/FriendInterests.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/LJ/Widget/FriendInterests.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -46,7 +46,7 @@ sub handle_post {
         $deleted = 1;
     }
     if (@toadd) {
-        my $maxinterests = $u->get_cap( 'interests' );
+        my $maxinterests = $u->count_max_interests;
 
         if ($intcount + scalar @toadd > $maxinterests) {
             if ($deleted) {
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/LJ/Widget/LinksList.pm
--- a/cgi-bin/LJ/Widget/LinksList.pm	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/LJ/Widget/LinksList.pm	Tue Nov 10 04:29:40 2009 +0000
@@ -31,7 +31,7 @@ sub render_body {
 
     # how many link inputs to show?
     my $showlinks = $post->{numlinks} || @$linkobj;
-    my $caplinks = $u->get_cap("userlinks");
+    my $caplinks = $u->count_max_userlinks;
     $showlinks += $link_more if $post->{'action:morelinks'};
     $showlinks = $link_min if $showlinks < $link_min;
     $showlinks = $caplinks if $showlinks > $caplinks;
diff -r 43b3103945b5 -r 7587b5545368 cgi-bin/ljprotocol.pl
--- a/cgi-bin/ljprotocol.pl	Tue Nov 10 04:15:30 2009 +0000
+++ b/cgi-bin/ljprotocol.pl	Tue Nov 10 04:29:40 2009 +0000
@@ -453,7 +453,7 @@ sub sendmessage
 
     return fail($err, 305) if $u->is_suspended; # suspended cannot send private messages
 
-    my $msg_limit = LJ::get_cap($u, "usermessage_length");
+    my $msg_limit = $u->count_usermessage_length;
 
     my @errors;
 
@@ -732,7 +732,7 @@ sub checkfriends
     my $res = {};
 
     # return immediately if they can't use this mode
-    unless (LJ::get_cap($u, "checkfriends")) {
+    unless ( $u->can_use_checkfriends ) {
         $res->{'new'} = 0;
         $res->{'interval'} = 36000;  # tell client to bugger off
         return $res;
@@ -1069,13 +1069,13 @@ sub postevent
     return fail($err,308) if ! $importer_bypass && $u->is_locked;
 
     # check the journal's read-only bit
-    return fail($err,306) if LJ::get_cap($uowner, "readonly");
+    return fail($err,306) if $uowner->is_readonly;
 
     # is the user allowed to post?
-    return fail($err,404,$LJ::MSG_NO_POST) unless $importer_bypass || LJ::get_cap($u, "can_post");
+    return fail($err,404,$LJ::MSG_NO_POST) unless $importer_bypass || $u->can_post;
 
     # is the user allowed to post?
-    return fail($err,410) if LJ::get_cap($u, "disable_can_post");
+    return fail($err,410) if $u->can_post_disabled;
 
     # read-only accounts can't post
     return fail($err,316) if $u->is_readonly;
@@ -1284,11 +1284,11 @@ sub postevent
         unless ($relcount) {
             # moderation queue full?
             my $modcount = $dbcm->selectrow_array("SELECT COUNT(*) FROM modlog WHERE journalid=$ownerid");
-            return fail($err, 407) if $modcount >= LJ::get_cap($uowner, "mod_queue");
+            return fail($err, 407) if $modcount >= $uowner->count_max_mod_queue;
 
             $modcount = $dbcm->selectrow_array("SELECT COUNT(*) FROM modlog ".
                                                "WHERE journalid=$ownerid AND posterid=$posterid");
-            return fail($err, 408) if $modcount >= LJ::get_cap($uowner, "mod_queue_per_poster");
+            return fail($err, 408) if $modcount >= $uowner->count_max_mod_queue_per_poster;
 
             $req->{'_moderate'}->{'authcode'} = LJ::make_auth_code(15);
 
@@ -1631,7 +1631,7 @@ sub editevent
     my $itemid = $req->{'itemid'}+0;
 
     # check the journal's read-only bit
-    return fail($err,306) if LJ::get_cap($uowner, "readonly");
+    return fail($err,306) if $uowner->is_readonly;
 
     # can't edit in deleted/suspended community
     return fail($err,307) unless $uowner->is_visible || $uowner->is_readonly;
@@ -2592,7 +2592,7 @@ sub login_message
         $res->{'message'} = $pre . translate($u, $code, $args);
     };
 
-    return $msg->("readonly")          if LJ::get_cap($u, "readonly");
+    return $msg->("readonly")          if $u->is_readonly;
     return $msg->("not_validated")     if ($u->{'status'} eq "N" and not $LJ::EVERYONE_VALID);
     return $msg->("must_revalidate")   if ($u->{'status'} eq "T" and not $LJ::EVERYONE_VALID);
 
diff -r 43b3103945b5 -r 7587b5545368 htdocs/customize/advanced/layers.bml
--- a/htdocs/customize/advanced/layers.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/customize/advanced/layers.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -86,7 +86,7 @@
         return $err->($ML{'error.invalidform'}) unless LJ::check_form_auth();
 
         return $err->($ML{'.error.maxlayers'})
-            if keys %$ulay >= LJ::get_cap($u, 's2layersmax');
+            if keys %$ulay >= $u->count_s2layersmax;
 
         my $err_badparid = $ML{'.error.badparentid'};
         my $type = $POST{'type'} or return $err->($ML{'.error.nolayertypeselected'});
diff -r 43b3103945b5 -r 7587b5545368 htdocs/customize/advanced/styles.bml
--- a/htdocs/customize/advanced/styles.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/customize/advanced/styles.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -271,7 +271,7 @@
             return "<b>$ML{'Error'}</b> $ML{'error.invalidform'}" unless LJ::check_form_auth();
 
             return $err->($ML{'.error.maxstyles'})
-                if scalar(keys %$ustyle) >= LJ::get_cap($u, 's2stylesmax');
+                if scalar(keys %$ustyle) >= $u->count_s2stylesmax;
 
             my $styleid = LJ::S2::create_style($u, $POST{'stylename'});
             return $err->($ML{'.error.cantcreatestyle'}) unless $styleid;
diff -r 43b3103945b5 -r 7587b5545368 htdocs/delcomment.bml
--- a/htdocs/delcomment.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/delcomment.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -50,7 +50,7 @@ _info?><?_code
     return $bad_input->($ML{'.error.suspended'})
         if $remote->is_suspended;
 
-    return $error->($LJ::MSG_READONLY_USER) if LJ::get_cap($u, "readonly");
+    return $error->($LJ::MSG_READONLY_USER) if $u->is_readonly;
 
     my $dbcr = LJ::get_cluster_def_reader($u);
     return $error->($ML{'error.nodb'})
diff -r 43b3103945b5 -r 7587b5545368 htdocs/editpics.bml
--- a/htdocs/editpics.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/editpics.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -51,7 +51,7 @@ use strict;
     my $returl = LJ::CleanHTML::canonical_url($POST{'ret'});
     my $picurl = LJ::CleanHTML::canonical_url($POST{'urlpic'});
 
-    if (LJ::get_cap($u, "readonly")) {
+    if ( $u->is_readonly ) {
         $title = "Read-only mode";
         $body = $LJ::MSG_READONLY_USER;
         return;
@@ -64,7 +64,7 @@ use strict;
     my @userpics = LJ::Userpic->load_user_userpics($u);
 
     # get maximum number of userpics for this user
-    my $max      = LJ::get_cap($u, "userpics");
+    my $max      = $u->count_max_userpics;
 
     my @info;
 
diff -r 43b3103945b5 -r 7587b5545368 htdocs/inbox/compose.bml
--- a/htdocs/inbox/compose.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/inbox/compose.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -32,7 +32,7 @@ body<=
     my $msg_subject = ''; # reply subject
     my $msg_body = ''; # reply body
     my $msg_parent = ''; # Hidden msg field containing id of parent message
-    my $msg_limit = LJ::get_cap($remote, "usermessage_length");
+    my $msg_limit = $remote->count_usermessage_length;
     my $force = 0; # flag for if user wants to force an empty PM
 
     my @errors;
diff -r 43b3103945b5 -r 7587b5545368 htdocs/interests.bml
--- a/htdocs/interests.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/interests.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -26,7 +26,7 @@ body<=
 
     my $remote = LJ::get_remote();
 
-    my $maxinterests = $remote ? $remote->get_cap( 'interests' ) : 0;
+    my $maxinterests = $remote ? $remote->count_max_interests : 0;
 
     my $table = sub { $_[0]->is_community ? 'comminterests' : 'userinterests' };
 
diff -r 43b3103945b5 -r 7587b5545368 htdocs/login.bml
--- a/htdocs/login.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/login.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -286,7 +286,7 @@
                     if $u->is_community && ! LJ::is_enabled('community-logins');
             }
 
-            if (LJ::get_cap($u, "readonly")) {
+            if ( $u->is_readonly ) {
                 return if $want_fail_redirect->("database_readonly");
 
                 $body = LJ::bad_input("The database is temporarily in read-only mode, so creating new login sessions is temporarily down.  Please try again later.");
diff -r 43b3103945b5 -r 7587b5545368 htdocs/manage/domain.bml
--- a/htdocs/manage/domain.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/manage/domain.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -23,7 +23,7 @@ body<=
     return LJ::bad_input("You could not be authenticated as the specified user.")
         unless $u;
 
-    return $LJ::MSG_READONLY_USER if LJ::get_cap($u, "readonly");
+    return $LJ::MSG_READONLY_USER if $u->is_readonly;
 
     ### user is now authenticated ###
 
diff -r 43b3103945b5 -r 7587b5545368 htdocs/manage/emailpost.bml
--- a/htdocs/manage/emailpost.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/manage/emailpost.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -36,7 +36,7 @@ body<=
     return LJ::server_down_html() if $LJ::SERVER_DOWN;
 
     my $u = LJ::get_remote();
-    return $LJ::MSG_READONLY_USER if LJ::get_cap($u, "readonly");
+    return $LJ::MSG_READONLY_USER if $u->is_readonly;
     my @props =
       qw/
       emailpost_pin emailpost_allowfrom
diff -r 43b3103945b5 -r 7587b5545368 htdocs/manage/externalaccount.bml
--- a/htdocs/manage/externalaccount.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/manage/externalaccount.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -21,7 +21,7 @@ use strict;
 
     return "<?needlogin?>" unless $u;
 
-    my $max_accts = LJ::get_cap($u, "xpost_accounts");
+    my $max_accts = $u->count_max_xpost_accounts;
 
     my %errs;
 
@@ -221,7 +221,7 @@ sub create_external_account {
     my ($u, $POST, $errs) = @_;
 
     # check to see if we're already at max.
-    my $max_accts = LJ::get_cap($u, "xpost_accounts");
+    my $max_accts = $u->count_max_xpost_accounts;
     my @accounts = DW::External::Account->get_external_accounts($u);
     my $acct_count = scalar @accounts;
     if ($acct_count >= $max_accts) {
diff -r 43b3103945b5 -r 7587b5545368 htdocs/manage/invites.bml
--- a/htdocs/manage/invites.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/manage/invites.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -22,7 +22,7 @@ body<=
     my $u = $remote;
     
     return $LJ::MSG_READONLY_USER
-        if LJ::get_cap($u, "readonly");
+        if $u->is_readonly;
 
     # always have links at top
     my $ret;
diff -r 43b3103945b5 -r 7587b5545368 htdocs/manage/profile/index.bml
--- a/htdocs/manage/profile/index.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/manage/profile/index.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -699,7 +699,7 @@ body<=
 
         # update interests
         unless ($POST{'interests_absent'}) {
-            my $maxinterests = $u->get_cap( 'interests' );
+            my $maxinterests = $u->count_max_interests;
 
             my @ints = LJ::interest_string_to_list($POST{'interests'});
             my $intcount = scalar(@ints);
diff -r 43b3103945b5 -r 7587b5545368 htdocs/manage/subscriptions/user.bml
--- a/htdocs/manage/subscriptions/user.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/manage/subscriptions/user.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -71,7 +71,7 @@ body<=
                                        event    => "NewUserpic",
                                        journal  => $journal,
                                        flags    => LJ::Subscription::TRACKING,
-                                       disabled => ! $remote->get_cap('track_user_newuserpic'),
+                                       disabled => ! $remote->can_track_new_userpic,
                                        ),
         LJ::Subscription::Pending->new(
                                        $remote,
diff -r 43b3103945b5 -r 7587b5545368 htdocs/manage/tags.bml
--- a/htdocs/manage/tags.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/manage/tags.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -182,7 +182,7 @@ HEAD
     <tr><td valign="top">
         <fieldset>
             <legend>};
-    $ret .= BML::ml( '.label.yours', { tagnum => $tagcount, tagmax => $u->get_cap('tags_max') } );
+    $ret .= BML::ml( '.label.yours', { tagnum => $tagcount, tagmax => $u->count_tags_max } );
     $ret .= qq(</legend>\n            <div style="padding-top: 6px;">);
 
     my $tagsort = sub {
diff -r 43b3103945b5 -r 7587b5545368 htdocs/talkmulti.bml
--- a/htdocs/talkmulti.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/talkmulti.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -39,7 +39,7 @@
 
     my $u = LJ::load_user($POST{'journal'});
     return $err->($ML{'talk.error.bogusargs'}) unless $u && $u->{'clusterid'};
-    return $err->($LJ::MSG_READONLY_USER) if LJ::get_cap($u, "readonly");
+    return $err->($LJ::MSG_READONLY_USER) if $u->is_readonly;
 
     my $dbcr = LJ::get_cluster_def_reader($u);
 
diff -r 43b3103945b5 -r 7587b5545368 htdocs/talkpost.bml
--- a/htdocs/talkpost.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/talkpost.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -50,7 +50,7 @@ body<=
     return $ML{'talk.error.nojournal'} unless $u;
 
     $r->notes->{journalid} = $u->{'userid'};
-    return $LJ::MSG_READONLY_USER if LJ::get_cap($u, "readonly");
+    return $LJ::MSG_READONLY_USER if $u->is_readonly;
 
     my $dbcr = LJ::get_cluster_def_reader($u);
 
@@ -372,8 +372,8 @@ body<=
         $ret .= "<?h1 $ML{'Sorry'} h1?><?p $ML{'.error.nocommentsjournal'} p?>";
         return $ret;
     }
-    unless (LJ::get_cap($u, "get_comments") ||
-            ($remote && LJ::get_cap($remote, "leave_comments"))) {
+    unless ($u->can_get_comments ||
+            ($remote && $remote->can_leave_comments)) {
         $ret .= "<?h1 $ML{'Sorry'} h1?><?p ";
         $ret .= $LJ::MSG_NO_COMMENT || "Sorry, you cannot leave comments at this time.";
         $ret .= " p?>";
diff -r 43b3103945b5 -r 7587b5545368 htdocs/talkscreen.bml
--- a/htdocs/talkscreen.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/talkscreen.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -94,7 +94,7 @@ _info?><?_code
     my $state = $post->{'state'};
 
     $u ||= LJ::load_userid($post->{'journalid'});
-    return $error->($LJ::MSG_READONLY_USER) if LJ::get_cap($u, "readonly");
+    return $error->($LJ::MSG_READONLY_USER) if $u->is_readonly;
 
     if ($post->{'posterid'}) {
         $post->{'userpost'} = LJ::get_username($post->{'posterid'});
diff -r 43b3103945b5 -r 7587b5545368 htdocs/tools/endpoints/esn_subs.bml
--- a/htdocs/tools/endpoints/esn_subs.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/tools/endpoints/esn_subs.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -61,7 +61,7 @@
         }
     } elsif ($action eq 'addsub') {
 
-        return $err->("Reached limit of " . $remote->get_cap('subscriptions') . " active subscriptions")
+        return $err->("Reached limit of " . $remote->count_max_subscriptions . " active subscriptions")
             unless $remote->can_add_inbox_subscription;
 
         my %subparams = ();
diff -r 43b3103945b5 -r 7587b5545368 htdocs/tools/recent_comments.bml
--- a/htdocs/tools/recent_comments.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/tools/recent_comments.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -29,7 +29,7 @@ body<=
     my $dbcr = LJ::get_cluster_reader($u);
     return "Error: can't get DB for user" unless $dbcr;
 
-    my $max = $u->get_cap("tools_recent_comments_display");
+    my $max = $u->count_recent_comments_display;
 
     # how many comments to display by default
     $GET{show} = $max if $GET{show} > $max;
diff -r 43b3103945b5 -r 7587b5545368 htdocs/update.bml
--- a/htdocs/update.bml	Tue Nov 10 04:15:30 2009 +0000
+++ b/htdocs/update.bml	Tue Nov 10 04:29:40 2009 +0000
@@ -50,13 +50,13 @@
             return;
         }
 
-        if (! LJ::get_cap($remote, "can_post")) {
+        if (! $remote->can_post ) {
             $$title = $ML{'.error.cantpost.title'};
             $$body = $LJ::MSG_NO_POST || $ML{'.error.cantpost'};
             return;
         }
 
-        if (LJ::get_cap($remote, "disable_can_post")) {
+        if ( $remote->can_post_disabled ) {
             unless (LJ::run_hook("update.bml_disable_can_post", {
                 title => $title, body => $body,
             })) {
--------------------------------------------------------------------------------