limiter = $limiter; $this->userManager = $userManager; $this->calDavBackend = $calDavBackend; $this->config = $config; $this->logger = $logger; $this->userId = $userId; } public function initialize(DAV\Server $server): void { $server->on('beforeBind', [$this, 'beforeBind'], 1); } public function beforeBind(string $path): void { if ($this->userId === null) { // We only care about authenticated users here return; } $user = $this->userManager->get($this->userId); if ($user === null) { // We only care about authenticated users here return; } $pathParts = explode('/', $path); if (count($pathParts) === 3 && $pathParts[0] === 'calendars') { // Path looks like calendars/username/calendarname so a new calendar or subscription is created try { $this->limiter->registerUserRequest( 'caldav-create-calendar', $this->config->getValueInt('dav', 'rateLimitCalendarCreation', 10), $this->config->getValueInt('dav', 'rateLimitPeriodCalendarCreation', 3600), $user ); } catch (RateLimitExceededException $e) { throw new TooManyRequests('Too many calendars created', 0, $e); } $calendarLimit = $this->config->getValueInt('dav', 'maximumCalendarsSubscriptions', 30); if ($calendarLimit === -1) { return; } $numCalendars = $this->calDavBackend->getCalendarsForUserCount('principals/users/' . $user->getUID()); $numSubscriptions = $this->calDavBackend->getSubscriptionsForUserCount('principals/users/' . $user->getUID()); if (($numCalendars + $numSubscriptions) >= $calendarLimit) { $this->logger->warning('Maximum number of calendars/subscriptions reached', [ 'calendars' => $numCalendars, 'subscription' => $numSubscriptions, 'limit' => $calendarLimit, ]); throw new Forbidden('Calendar limit reached', 0); } } } } td class='sub right'>www-data
aboutsummaryrefslogtreecommitdiffstats
path: root/ui/effect-blind.js
blob: 87382615c0827fd0116649c4dec01ea92bd7b3fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*!
 * jQuery UI Effects Blind @VERSION
 * http://jqueryui.com
 *
 * Copyright jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 */

//>>label: Blind Effect
//>>group: Effects
//>>description: Blinds the element.
//>>docs: http://api.jqueryui.com/blind-effect/
//>>demos: http://jqueryui.com/effect/

( function( factory ) {
	if ( typeof define === "function" && define.amd ) {

		// AMD. Register as an anonymous module.
		define( [
			"jquery",
			"./version",
			"./effect"
		], factory );
	} else {

		// Browser globals
		factory( jQuery );
	}
}( function( $ ) {

return $.effects.define( "blind", "hide", function( options, done ) {
	var map = {
			up: [ "bottom", "top" ],
			vertical: [ "bottom", "top" ],
			down: [ "top", "bottom" ],
			left: [ "right", "left" ],
			horizontal: [ "right", "left" ],
			right: [ "left", "right" ]
		},
		element = $( this ),
		direction = options.direction || "up",
		start = element.cssClip(),
		animate = { clip: $.extend( {}, start ) },
		placeholder = $.effects.createPlaceholder( element );

	animate.clip[ map[ direction ][ 0 ] ] = animate.clip[ map[ direction ][ 1 ] ];

	if ( options.mode === "show" ) {
		element.cssClip( animate.clip );
		if ( placeholder ) {
			placeholder.css( $.effects.clipToBox( animate ) );
		}

		animate.clip = start;
	}

	if ( placeholder ) {
		placeholder.animate( $.effects.clipToBox( animate ), options.duration, options.easing );
	}

	element.animate( animate, {
		queue: false,
		duration: options.duration,
		easing: options.easing,
		complete: done
	} );
} );

} ) );