4. Setting Capabilities

Capabilities are used to define limits that are imposed on user accounts. For more information on what capabilities are, and how they work, please read Chapter 23, Capabilities Classes.

Note

Consult Section 3, “Capabilities Reference” for reference when defining capabilities.

No matter what your setup is, %LJ::CAP_DEF should always be defined, set with sane limits per capability. These default capability limits are used when no other class-specific limit defined under %LJ::CAP matches.

Example 10.1. Sample %LJ::CAP_DEF

%CAP_DEF = (
        'maxfriends' => 500,
        'userpics' => 2,
        'checkfriends_interval' => 60,
        'checkfriends' => 1,
        'styles' => 0,
        'todomax' => 25,
        'todosec' => 0,
        'friendsviewupdate' => 30,
        'findsim' => 1,
        'getselfemail' => 0,
);
      


Classes.  Classes are defined as hashes under the single hash %LJ::CAP. The keys of %LJ::CAP are the 16 different bits (0-15). The keys of those hashrefs are the capability names, and the values are the capability settings.

Example 10.2. Sample %LJ::CAP

%CAP = (
    '0' => {  # 0x01
        '_name' => 'new user',
        'userpics' => 2,
    },
    '1' => {  # 0x02
        '_name' => 'free user',
        'userpics' => 3,
    },
    '2' => {  # 0x04
        '_name' => 'paid user',
        'styles' => 1,
        'makepoll' => 1,
        'userpics' => 10,
        'paid' => 1,
        'useremail' => 1,
        'textmessaging' => 1,
    },
    '3' => {  # 0x08
        '_name' => 'permanent account',
        'paid' => 1,
        'useremail' => 1,
    },
);