# shiftcontroller/4.9.85/sh4/calendars/html/admin/controller/permissions.php

ShiftController Employee Shift Scheduling, version 4.9.85. 32 lines.

- Page: https://pluginprobe.com/plugins/shiftcontroller/4.9.85/code/sh4/calendars/html/admin/controller/permissions.php
- Raw: https://pluginprobe.com/plugins/shiftcontroller/4.9.85/raw/sh4/calendars/html/admin/controller/permissions.php
- Modified: 2023-05-29T12:46:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/shiftcontroller/4.9.85/code/sh4/calendars/html/admin/controller/permissions.php#L10-L20`.

```php
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
#[AllowDynamicProperties]
class SH4_Calendars_Html_Admin_Controller_Permissions
{
	public function __construct(
		HC3_Hooks $hooks,
		HC3_Post $post,

		SH4_Calendars_Permissions $calendarsPermissions,
		SH4_Calendars_Query $calendarsQuery
		)
	{
		$this->post = $hooks->wrap( $post );

		$this->calendarsPermissions = $hooks->wrap( $calendarsPermissions );
		$this->calendarsQuery = $hooks->wrap( $calendarsQuery );
	}

	public function execute( $calendarId )
	{
		$calendar = $this->calendarsQuery->findById( $calendarId );

		$current = $this->calendarsPermissions->getAll( $calendar );
		foreach( $current as $key => $value ){
			$newValue = $this->post->get($key) ? 1 : 0;
			$this->calendarsPermissions->set( $calendar, $key, $newValue );
		}

		$return = array( 'admin/calendars/' . $calendarId . '/prm', '__Calendar Updated__' );
		return $return;
	}
}
```
