Setting up quota allocations

In many organizations PaperCut NG is used to control and restrict users to sensible use by allocating a quota or allowance (a budget). For example a user may be allocated $10.00 a week. This type of control is particularly popular in schools and universities. The process of quota allocation can be automated via the Groups section.

To allocate a $10.00 a week to members of the Students group:

  1. Navigate to the Groups section

  2. Add the Student group via Add/Remove Groups if not already listed.

  3. Select the Student group

  4. Under the Quota Scheduling section, select a period of Weekly and enter 10.00 in the Schedule amount.

  5. Click the Apply button to save the change.

The Group Details screen

Figure 6.2. The Group Details screen

To configure quotas correctly it is important to understand how quota allocations work. Users receive quotas for all groups they belong to. For example, consider the situations where Students and Student Newspaper groups are defined in PaperCut NG, with $20/month and $10/month quotas respectively. If a student belongs to both groups they will receive a $30/month of quota. If they belong to only the Students group they will receive only $20/month.

If you configure a quota on the special [All Users] group then all users in the system will receive this quota in addition to quotas defined on other groups.

Credit will be assigned to group members at just past 12:00am (midnight) on the day of the schedule. Administrators can verify that this has taken place by inspecting log entries in the Application event log and/or users' transaction logs.

TaskTime

Daily Allocations

Applied at 12:10am every day (7 days a week).

Weekly Allocations

Applied at 12:20am on Sunday.

Monthly Allocations

Applied at 12:30am on the first day of the month.

Custom Allocations

Applied at 12:10am on the given day (after the daily allocations).

Table 6.1. Quota schedule times

One potential issue associated with quota allocation in some organizations (for example Schools or Universities) is that users can "bank up" their quota allowance over time leading to excessive use at periods of the year such as the end of semester. The Only allow accumulation up to option can be used to implement a "use it or lose it" policy!

Custom Quota Scheduling Periods

In some cases quotas may need to be scheduled for unusual times. A good example of this is unusual term or semester start dates. The Custom quota scheduling period allows specifying any date for which to run quotas. To set a custom quota scheduling period:

  • Select the group for which to allocate quotas

  • Under the Quota Scheduling section, select a Period of Custom.

  • Enter a date in the ISO international date format YYYY-MM-DD (e.g. 2007-03-15). Multiple dates may be entered, separated by a comma (e.g. 2007-03-15,2007-08-20). * wildcards are supported.

  • Click the Apply button to save the change.

Tip

The year may be omitted or replaced with a * wildcard to specify that quota allocations should take place on the same date every year. The same is true for months.

For example, entering *-03-15 or 03-15 will result in quotas being allocated on March 15th every year.

Entering *-*-15 will result in quotas being allocated the 15th of every month of every year.

Advanced User Quota Management

Some organizations may require scheduling quota allocations for periods other than those available above. For example, an education organization may like to schedule quota allocation per term, semester (period) or academic year, which may not have set dates. This can be achieved by a manual update when necessary though Bulk user actions ... in the Users or Groups tab. More information is available in the section called “Bulk User Operations”.

It is also possible to automate the allocation of user quota through the use of Server Commands (see the section called “Server Commands (server-command)”) or XML Web Services (see the section called “The XML Web Services API”).

Automated Quota Allocation Example

One way to automate quota allocation is through the use of Server Commands. Following is an example of how to use Server Commands to automate quota allocation in a Microsoft Windows environment:

North Shore High would like to automate their quota allocation on a per-term basis. There are four terms in a year, and terms do not necessarily start on the same date every year. Junior students are to receive $5 per term printing budget, and senior students are to receive $10 per term. The domain has the groups junior-students and senior-students to reflect the students' grade.

Using the information from the section called “Server Commands (server-command)”, we can see that the Server Command adjust-user-account-balance-by-group will meet the needs of this situation. Create a batch file with a name like assign-term-quotas.bat with content similar to the following (depending on your environment):

                cd "C:\Program Files\PaperCut NG\server\bin\win"
                server-command adjust-user-account-balance-by-group "junior-students" \
                +5.00 "$5 term budget for junior students"
                server-command adjust-user-account-balance-by-group "senior-students" \
                +10.00 "$10 term budget for senior students"
            

Note: backslash indicates text should appear on the same line.

Running this script will allocate $5 to all members of the group junior-students, and $10 to all members of the group senior-students. The script can then be scheduled to run at the specified dates by the use of a tool such as Windows Task Scheduler ( Control PanelScheduled TasksAdd Scheduled Task).

This example can be found with your PaperCut NG installation under [app-path]\server\examples\scripting\batch\assign-term-quotas.bat.