Completed
Branch Gutenberg/use-new-wordpress-pa... (9fa7a4)
by
unknown
63:25 queued 48:18
created
core/db_models/strategies/EE_Restriction_Generator_Reg_Form.strategy.php 2 patches
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -15,51 +15,51 @@
 block discarded – undo
15 15
 class EE_Restriction_Generator_Reg_Form extends EE_Restriction_Generator_Base
16 16
 {
17 17
 
18
-    /**
19
-     *
20
-     * @var string the name of the field that indicates whether or not this is a system thing
21
-     */
22
-    protected $_system_field_name = null;
18
+	/**
19
+	 *
20
+	 * @var string the name of the field that indicates whether or not this is a system thing
21
+	 */
22
+	protected $_system_field_name = null;
23 23
 
24
-    /**
25
-     * Accepts the name of the field that indicates whether or not an object is a "system" one or not
26
-     * @param string $system_field_name
27
-     */
28
-    public function __construct($system_field_name)
29
-    {
30
-        $this->_system_field_name = $system_field_name;
31
-    }
24
+	/**
25
+	 * Accepts the name of the field that indicates whether or not an object is a "system" one or not
26
+	 * @param string $system_field_name
27
+	 */
28
+	public function __construct($system_field_name)
29
+	{
30
+		$this->_system_field_name = $system_field_name;
31
+	}
32 32
 
33 33
 
34
-    /**
35
-     *
36
-     * @return \EE_Default_Where_Conditions[]
37
-     * @throws EE_Error
38
-     */
39
-    protected function _generate_restrictions()
40
-    {
41
-        // if there are no standard caps for this model, then for now all we know
42
-        // if they need the default cap to access this
43
-        if (! $this->model()->cap_slug()) {
44
-            return array(
45
-                EE_Restriction_Generator_Base::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions()
46
-            );
47
-        }
48
-        $restrictions = array(
49
-            EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) => new EE_Return_None_Where_Conditions(),
50
-        );
51
-        // there is no "ee_read_system_questions" cap; in order to read reg form items you only need "ee_read_{model_name}".
52
-        // there is also no "ee_delete_system_questions" cap. But folks shouldn't be deleting system questions anyway
53
-        if ($this->action() !== EEM_Base::caps_read) {
54
-            $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_system') ] = new EE_Default_Where_Conditions(
55
-                array(
56
-                    'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_system') => array(
57
-                        $this->_system_field_name       => array('IN', array('', 0)),
58
-                        $this->_system_field_name . '*' => array('IS_NULL')
59
-                    )
60
-                )
61
-            );
62
-        }
63
-        return $restrictions;
64
-    }
34
+	/**
35
+	 *
36
+	 * @return \EE_Default_Where_Conditions[]
37
+	 * @throws EE_Error
38
+	 */
39
+	protected function _generate_restrictions()
40
+	{
41
+		// if there are no standard caps for this model, then for now all we know
42
+		// if they need the default cap to access this
43
+		if (! $this->model()->cap_slug()) {
44
+			return array(
45
+				EE_Restriction_Generator_Base::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions()
46
+			);
47
+		}
48
+		$restrictions = array(
49
+			EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) => new EE_Return_None_Where_Conditions(),
50
+		);
51
+		// there is no "ee_read_system_questions" cap; in order to read reg form items you only need "ee_read_{model_name}".
52
+		// there is also no "ee_delete_system_questions" cap. But folks shouldn't be deleting system questions anyway
53
+		if ($this->action() !== EEM_Base::caps_read) {
54
+			$restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_system') ] = new EE_Default_Where_Conditions(
55
+				array(
56
+					'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_system') => array(
57
+						$this->_system_field_name       => array('IN', array('', 0)),
58
+						$this->_system_field_name . '*' => array('IS_NULL')
59
+					)
60
+				)
61
+			);
62
+		}
63
+		return $restrictions;
64
+	}
65 65
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     {
41 41
         // if there are no standard caps for this model, then for now all we know
42 42
         // if they need the default cap to access this
43
-        if (! $this->model()->cap_slug()) {
43
+        if ( ! $this->model()->cap_slug()) {
44 44
             return array(
45 45
                 EE_Restriction_Generator_Base::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions()
46 46
             );
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
         // there is no "ee_read_system_questions" cap; in order to read reg form items you only need "ee_read_{model_name}".
52 52
         // there is also no "ee_delete_system_questions" cap. But folks shouldn't be deleting system questions anyway
53 53
         if ($this->action() !== EEM_Base::caps_read) {
54
-            $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_system') ] = new EE_Default_Where_Conditions(
54
+            $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_system')] = new EE_Default_Where_Conditions(
55 55
                 array(
56
-                    'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_system') => array(
56
+                    'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_system') => array(
57 57
                         $this->_system_field_name       => array('IN', array('', 0)),
58
-                        $this->_system_field_name . '*' => array('IS_NULL')
58
+                        $this->_system_field_name.'*' => array('IS_NULL')
59 59
                     )
60 60
                 )
61 61
             );
Please login to merge, or discard this patch.
strategies/EE_Restriction_Generator_Event_Related_Protected.strategy.php 2 patches
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -17,86 +17,86 @@
 block discarded – undo
17 17
 class EE_Restriction_Generator_Event_Related_Protected extends EE_Restriction_Generator_Base
18 18
 {
19 19
 
20
-    /**
21
-     * Path to the event model from the model this restriction generator will be applied to;
22
-     * including the event model itself. Eg "Ticket.Datetime.Event"
23
-     * @var string
24
-     */
25
-    protected $_path_to_event_model = null;
20
+	/**
21
+	 * Path to the event model from the model this restriction generator will be applied to;
22
+	 * including the event model itself. Eg "Ticket.Datetime.Event"
23
+	 * @var string
24
+	 */
25
+	protected $_path_to_event_model = null;
26 26
 
27
-    /**
28
-     * Capability context on event model when creating restrictions.
29
-     * Eg, although we may want capability restrictions relating to deleting datetimes,
30
-     * they don't need to be able to DELETE EVENTS, they just need to be able to
31
-     * EDIT EVENTS in order to DELETE DATETIMES.
32
-     * @var string one of EEM_Base::valid_cap_contexts()
33
-     */
34
-    protected $_cap_context_on_event_model = null;
35
-    /**
36
-     *
37
-     * @param string $path_to_event_model
38
-     * @param string $cap_context_on_event_model  capability context on event model when creating restrictions.
39
-     * Eg, although we may want capability restrictions relating to deleting datetimes,
40
-     * they don't need to be able to DELETE EVENTS, they just need to be able to
41
-     * EDIT EVENTS in order to DELETE DATETIMES. If none if provided, assumed to be the same
42
-     * as on the primary model.
43
-     */
44
-    public function __construct($path_to_event_model, $cap_context_on_event_model = null)
45
-    {
46
-        if (substr($path_to_event_model, -1, 1) != '.') {
47
-            $path_to_event_model .= '.';
48
-        }
49
-        $this->_path_to_event_model = $path_to_event_model;
50
-        $this->_cap_context_on_event_model = $cap_context_on_event_model;
51
-    }
27
+	/**
28
+	 * Capability context on event model when creating restrictions.
29
+	 * Eg, although we may want capability restrictions relating to deleting datetimes,
30
+	 * they don't need to be able to DELETE EVENTS, they just need to be able to
31
+	 * EDIT EVENTS in order to DELETE DATETIMES.
32
+	 * @var string one of EEM_Base::valid_cap_contexts()
33
+	 */
34
+	protected $_cap_context_on_event_model = null;
35
+	/**
36
+	 *
37
+	 * @param string $path_to_event_model
38
+	 * @param string $cap_context_on_event_model  capability context on event model when creating restrictions.
39
+	 * Eg, although we may want capability restrictions relating to deleting datetimes,
40
+	 * they don't need to be able to DELETE EVENTS, they just need to be able to
41
+	 * EDIT EVENTS in order to DELETE DATETIMES. If none if provided, assumed to be the same
42
+	 * as on the primary model.
43
+	 */
44
+	public function __construct($path_to_event_model, $cap_context_on_event_model = null)
45
+	{
46
+		if (substr($path_to_event_model, -1, 1) != '.') {
47
+			$path_to_event_model .= '.';
48
+		}
49
+		$this->_path_to_event_model = $path_to_event_model;
50
+		$this->_cap_context_on_event_model = $cap_context_on_event_model;
51
+	}
52 52
 
53
-    /**
54
-     * Returns `$this->_cap_context_on_event_model`, the relevant action ("read",
55
-     * "read_admin", "edit" or "delete") for the EVENT related to this model.
56
-     * @see EE_Restriction_Generator_Event_Related_Protected::__construct()
57
-     * @return string one of EEM_Base::valid_cap_contexts()
58
-     */
59
-    protected function action_for_event()
60
-    {
61
-        if ($this->_cap_context_on_event_model) {
62
-            return $this->_cap_context_on_event_model;
63
-        } else {
64
-            return $this->action();
65
-        }
66
-    }
53
+	/**
54
+	 * Returns `$this->_cap_context_on_event_model`, the relevant action ("read",
55
+	 * "read_admin", "edit" or "delete") for the EVENT related to this model.
56
+	 * @see EE_Restriction_Generator_Event_Related_Protected::__construct()
57
+	 * @return string one of EEM_Base::valid_cap_contexts()
58
+	 */
59
+	protected function action_for_event()
60
+	{
61
+		if ($this->_cap_context_on_event_model) {
62
+			return $this->_cap_context_on_event_model;
63
+		} else {
64
+			return $this->action();
65
+		}
66
+	}
67 67
 
68
-    /**
69
-     *
70
-     * @return \EE_Default_Where_Conditions
71
-     */
72
-    protected function _generate_restrictions()
73
-    {
74
-        // if there are no standard caps for this model, then for now all we know
75
-        // if they need the default cap to access this
76
-        if (! $this->model()->cap_slug()) {
77
-            return array(
78
-                self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions()
79
-            );
80
-        }
68
+	/**
69
+	 *
70
+	 * @return \EE_Default_Where_Conditions
71
+	 */
72
+	protected function _generate_restrictions()
73
+	{
74
+		// if there are no standard caps for this model, then for now all we know
75
+		// if they need the default cap to access this
76
+		if (! $this->model()->cap_slug()) {
77
+			return array(
78
+				self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions()
79
+			);
80
+		}
81 81
 
82
-        $event_model = EEM_Event::instance();
83
-        return array(
84
-            // first: basically access to non-defaults is essentially controlled by which events are accessible
85
-            // if they don't have the basic event cap, they can't access ANY non-default items
86
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event())              => new EE_Return_None_Where_Conditions(),
87
-            // if they don't have the others event cap, they can't access others' non-default items
88
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others')  => new EE_Default_Where_Conditions(
89
-                array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder )
90
-            ),
91
-            // if they have basic and others, but not private, they can't access others' private non-default items
92
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions(
93
-                array(
94
-                    'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => array(
95
-                        $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
96
-                        $this->_path_to_event_model . 'status'      => array( '!=', 'private' )
97
-                    )
98
-                )
99
-            ),
100
-        );
101
-    }
82
+		$event_model = EEM_Event::instance();
83
+		return array(
84
+			// first: basically access to non-defaults is essentially controlled by which events are accessible
85
+			// if they don't have the basic event cap, they can't access ANY non-default items
86
+			EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event())              => new EE_Return_None_Where_Conditions(),
87
+			// if they don't have the others event cap, they can't access others' non-default items
88
+			EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others')  => new EE_Default_Where_Conditions(
89
+				array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder )
90
+			),
91
+			// if they have basic and others, but not private, they can't access others' private non-default items
92
+			EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions(
93
+				array(
94
+					'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => array(
95
+						$this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
96
+						$this->_path_to_event_model . 'status'      => array( '!=', 'private' )
97
+					)
98
+				)
99
+			),
100
+		);
101
+	}
102 102
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     {
74 74
         // if there are no standard caps for this model, then for now all we know
75 75
         // if they need the default cap to access this
76
-        if (! $this->model()->cap_slug()) {
76
+        if ( ! $this->model()->cap_slug()) {
77 77
             return array(
78 78
                 self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions()
79 79
             );
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
             // if they don't have the basic event cap, they can't access ANY non-default items
86 86
             EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event())              => new EE_Return_None_Where_Conditions(),
87 87
             // if they don't have the others event cap, they can't access others' non-default items
88
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_others')  => new EE_Default_Where_Conditions(
89
-                array( $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder )
88
+            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_others')  => new EE_Default_Where_Conditions(
89
+                array($this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder)
90 90
             ),
91 91
             // if they have basic and others, but not private, they can't access others' private non-default items
92
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => new EE_Default_Where_Conditions(
92
+            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_private') => new EE_Default_Where_Conditions(
93 93
                 array(
94
-                    'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event() . '_private') => array(
95
-                        $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
96
-                        $this->_path_to_event_model . 'status'      => array( '!=', 'private' )
94
+                    'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action_for_event().'_private') => array(
95
+                        $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
96
+                        $this->_path_to_event_model.'status'      => array('!=', 'private')
97 97
                     )
98 98
                 )
99 99
             ),
Please login to merge, or discard this patch.
strategies/EE_Restriction_Generator_Default_Protected.strategy.php 2 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -17,85 +17,85 @@
 block discarded – undo
17 17
  */
18 18
 class EE_Restriction_Generator_Default_Protected extends EE_Restriction_Generator_Base
19 19
 {
20
-    /**
21
-     * Name of the field on this model (or a related model, including the model chain to it)
22
-     * that is a boolean indicating whether or not a model object is considered "Default" or not
23
-     * @var string
24
-     */
25
-    protected $_default_field_name;
20
+	/**
21
+	 * Name of the field on this model (or a related model, including the model chain to it)
22
+	 * that is a boolean indicating whether or not a model object is considered "Default" or not
23
+	 * @var string
24
+	 */
25
+	protected $_default_field_name;
26 26
 
27
-    /**
28
-     * The model chain to follow to get to the event model, including the event model itself.
29
-     * Eg 'Ticket.Datetime.Event'
30
-     * @var string
31
-     */
32
-    protected $_path_to_event_model;
33
-    /**
34
-     *
35
-     * @param string $default_field_name the name of the field Name of the field on this model (or a related model, including the model chain to it)
36
-     * that is a boolean indicating whether or not a model object is considered "Default" or not
37
-     * @param string $path_to_event_model The model chain to follow to get to the event model, including the event model itself.
38
-     * Eg 'Ticket.Datetime.Event'
39
-     */
40
-    public function __construct($default_field_name, $path_to_event_model)
41
-    {
42
-        $this->_default_field_name = $default_field_name;
43
-        if (substr($path_to_event_model, -1, 1) != '.') {
44
-            $path_to_event_model .= '.';
45
-        }
46
-        $this->_path_to_event_model = $path_to_event_model;
47
-    }
27
+	/**
28
+	 * The model chain to follow to get to the event model, including the event model itself.
29
+	 * Eg 'Ticket.Datetime.Event'
30
+	 * @var string
31
+	 */
32
+	protected $_path_to_event_model;
33
+	/**
34
+	 *
35
+	 * @param string $default_field_name the name of the field Name of the field on this model (or a related model, including the model chain to it)
36
+	 * that is a boolean indicating whether or not a model object is considered "Default" or not
37
+	 * @param string $path_to_event_model The model chain to follow to get to the event model, including the event model itself.
38
+	 * Eg 'Ticket.Datetime.Event'
39
+	 */
40
+	public function __construct($default_field_name, $path_to_event_model)
41
+	{
42
+		$this->_default_field_name = $default_field_name;
43
+		if (substr($path_to_event_model, -1, 1) != '.') {
44
+			$path_to_event_model .= '.';
45
+		}
46
+		$this->_path_to_event_model = $path_to_event_model;
47
+	}
48 48
 
49 49
 
50 50
 
51
-    /**
52
-     *
53
-     * @return \EE_Default_Where_Conditions
54
-     */
55
-    protected function _generate_restrictions()
56
-    {
57
-        // if there are no standard caps for this model, then for now all we know is
58
-        // if they need the default cap to access this
59
-        if (! $this->model()->cap_slug()) {
60
-            return array(
61
-                self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions()
62
-            );
63
-        }
51
+	/**
52
+	 *
53
+	 * @return \EE_Default_Where_Conditions
54
+	 */
55
+	protected function _generate_restrictions()
56
+	{
57
+		// if there are no standard caps for this model, then for now all we know is
58
+		// if they need the default cap to access this
59
+		if (! $this->model()->cap_slug()) {
60
+			return array(
61
+				self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions()
62
+			);
63
+		}
64 64
 
65
-        $event_model = EEM_Event::instance();
65
+		$event_model = EEM_Event::instance();
66 66
 
67
-        $restrictions =  array(
68
-            // first: basically access to non-defaults is essentially controlled by which events are accessible
69
-            // if they don't have the basic event cap, they can't access ANY non-default items
70
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array( $this->_default_field_name => true )),
71
-            // if they don't have the others event cap, they can't access others' non-default items
72
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions(array(
73
-                'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => array(
74
-                    $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder ),
75
-                    $this->_default_field_name => true )),
76
-            // if they have basic and others, but not private, they can't access others' private non-default items
77
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions(array(
78
-                'OR*no_' .EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => array(
79
-                $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
80
-                $this->_path_to_event_model . 'status' => array( '!=', 'private' ),
81
-                $this->_default_field_name => true ) )),
82
-            // second: access to defaults is controlled by the defaulty capabilities
83
-            // if they don't have the default capability, restrict access to only non-default items
84
-            EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_default') => new EE_Default_Where_Conditions(array( $this->_default_field_name => false )),
85
-            // if they don't have the "others" default capability, restrict access to only their default ones, and non-default ones
86
-             );
87
-        if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others_default')) {
88
-            $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') ] = new EE_Default_Where_Conditions(array(
89
-                    // if they don't have the others default cap, they can't access others default items (but they can access
90
-                    // their own default items, and non-default items)
91
-                    'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') => array(
92
-                        'AND' => array(
93
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
94
-                            $this->_default_field_name => true
95
-                            ),
96
-                        $this->_default_field_name => false
97
-                    ) ));
98
-        }
99
-        return $restrictions;
100
-    }
67
+		$restrictions =  array(
68
+			// first: basically access to non-defaults is essentially controlled by which events are accessible
69
+			// if they don't have the basic event cap, they can't access ANY non-default items
70
+			EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array( $this->_default_field_name => true )),
71
+			// if they don't have the others event cap, they can't access others' non-default items
72
+			EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions(array(
73
+				'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => array(
74
+					$this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder ),
75
+					$this->_default_field_name => true )),
76
+			// if they have basic and others, but not private, they can't access others' private non-default items
77
+			EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions(array(
78
+				'OR*no_' .EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => array(
79
+				$this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
80
+				$this->_path_to_event_model . 'status' => array( '!=', 'private' ),
81
+				$this->_default_field_name => true ) )),
82
+			// second: access to defaults is controlled by the defaulty capabilities
83
+			// if they don't have the default capability, restrict access to only non-default items
84
+			EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_default') => new EE_Default_Where_Conditions(array( $this->_default_field_name => false )),
85
+			// if they don't have the "others" default capability, restrict access to only their default ones, and non-default ones
86
+			 );
87
+		if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others_default')) {
88
+			$restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') ] = new EE_Default_Where_Conditions(array(
89
+					// if they don't have the others default cap, they can't access others default items (but they can access
90
+					// their own default items, and non-default items)
91
+					'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') => array(
92
+						'AND' => array(
93
+							$this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
94
+							$this->_default_field_name => true
95
+							),
96
+						$this->_default_field_name => false
97
+					) ));
98
+		}
99
+		return $restrictions;
100
+	}
101 101
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     {
57 57
         // if there are no standard caps for this model, then for now all we know is
58 58
         // if they need the default cap to access this
59
-        if (! $this->model()->cap_slug()) {
59
+        if ( ! $this->model()->cap_slug()) {
60 60
             return array(
61 61
                 self::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions()
62 62
             );
@@ -64,33 +64,33 @@  discard block
 block discarded – undo
64 64
 
65 65
         $event_model = EEM_Event::instance();
66 66
 
67
-        $restrictions =  array(
67
+        $restrictions = array(
68 68
             // first: basically access to non-defaults is essentially controlled by which events are accessible
69 69
             // if they don't have the basic event cap, they can't access ANY non-default items
70
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array( $this->_default_field_name => true )),
70
+            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action()) => new EE_Default_Where_Conditions(array($this->_default_field_name => true)),
71 71
             // if they don't have the others event cap, they can't access others' non-default items
72
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => new EE_Default_Where_Conditions(array(
73
-                'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_others') => array(
74
-                    $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder ),
72
+            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => new EE_Default_Where_Conditions(array(
73
+                'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_others') => array(
74
+                    $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder ),
75 75
                     $this->_default_field_name => true )),
76 76
             // if they have basic and others, but not private, they can't access others' private non-default items
77
-            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => new EE_Default_Where_Conditions(array(
78
-                'OR*no_' .EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action() . '_private') => array(
79
-                $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
80
-                $this->_path_to_event_model . 'status' => array( '!=', 'private' ),
77
+            EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => new EE_Default_Where_Conditions(array(
78
+                'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($event_model, $this->action().'_private') => array(
79
+                $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
80
+                $this->_path_to_event_model.'status' => array('!=', 'private'),
81 81
                 $this->_default_field_name => true ) )),
82 82
             // second: access to defaults is controlled by the defaulty capabilities
83 83
             // if they don't have the default capability, restrict access to only non-default items
84
-            EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_default') => new EE_Default_Where_Conditions(array( $this->_default_field_name => false )),
84
+            EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_default') => new EE_Default_Where_Conditions(array($this->_default_field_name => false)),
85 85
             // if they don't have the "others" default capability, restrict access to only their default ones, and non-default ones
86 86
              );
87
-        if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others_default')) {
88
-            $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') ] = new EE_Default_Where_Conditions(array(
87
+        if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action().'_others_default')) {
88
+            $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others_default')] = new EE_Default_Where_Conditions(array(
89 89
                     // if they don't have the others default cap, they can't access others default items (but they can access
90 90
                     // their own default items, and non-default items)
91
-                    'OR*no_' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others_default') => array(
91
+                    'OR*no_'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others_default') => array(
92 92
                         'AND' => array(
93
-                            $this->_path_to_event_model . 'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
93
+                            $this->_path_to_event_model.'EVT_wp_user' => EE_Default_Where_Conditions::current_user_placeholder,
94 94
                             $this->_default_field_name => true
95 95
                             ),
96 96
                         $this->_default_field_name => false
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Restriction_Generator_Base.strategy.php 2 patches
Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -27,150 +27,150 @@
 block discarded – undo
27 27
 abstract class EE_Restriction_Generator_Base
28 28
 {
29 29
 
30
-    /**
31
-     * The restrictions generated by this object. FALSE before any are made.
32
-     * @var EE_Default_Where_Conditions[]
33
-     */
34
-    protected $_cap_restrictions_generated = false;
30
+	/**
31
+	 * The restrictions generated by this object. FALSE before any are made.
32
+	 * @var EE_Default_Where_Conditions[]
33
+	 */
34
+	protected $_cap_restrictions_generated = false;
35 35
 
36
-    /**
37
-     * Model for which restrictions are generated
38
-     * @var EEM_Base
39
-     */
40
-    protected $_model;
36
+	/**
37
+	 * Model for which restrictions are generated
38
+	 * @var EEM_Base
39
+	 */
40
+	protected $_model;
41 41
 
42
-    /**
43
-     * One of EEM_Base::valid_cap_contexts()
44
-     * @var string
45
-     */
46
-    protected $_action;
47
-    /**
48
-     * Puts the last necessary info onto the restriction generator class. This is usually
49
-     * called by EEM_Base during its constructor, so child classes don't have to
50
-     * always provide this info.
51
-     * @param EEM_Base $model
52
-     * @param string $action
53
-     */
54
-    public function _construct_finalize(EEM_Base $model, $action)
55
-    {
56
-        $this->_model = $model;
57
-        $this->_action = $action;
58
-    }
42
+	/**
43
+	 * One of EEM_Base::valid_cap_contexts()
44
+	 * @var string
45
+	 */
46
+	protected $_action;
47
+	/**
48
+	 * Puts the last necessary info onto the restriction generator class. This is usually
49
+	 * called by EEM_Base during its constructor, so child classes don't have to
50
+	 * always provide this info.
51
+	 * @param EEM_Base $model
52
+	 * @param string $action
53
+	 */
54
+	public function _construct_finalize(EEM_Base $model, $action)
55
+	{
56
+		$this->_model = $model;
57
+		$this->_action = $action;
58
+	}
59 59
 
60
-    /**
61
-     * Returns the model set for this restriction generator
62
-     *
63
-     * @throws EE_Error
64
-     * @return EEM_Base | EEM_Soft_Delete_Base
65
-     */
66
-    public function model()
67
-    {
68
-        if (! $this->_model instanceof EEM_Base) {
69
-            throw new EE_Error(sprintf(__('Cannot generate capability restrictions because model has not yet been set on the %s. Please ensure _construct_finalize() was called', 'event_espresso'), get_class($this)));
70
-        }
71
-        return $this->_model;
72
-    }
60
+	/**
61
+	 * Returns the model set for this restriction generator
62
+	 *
63
+	 * @throws EE_Error
64
+	 * @return EEM_Base | EEM_Soft_Delete_Base
65
+	 */
66
+	public function model()
67
+	{
68
+		if (! $this->_model instanceof EEM_Base) {
69
+			throw new EE_Error(sprintf(__('Cannot generate capability restrictions because model has not yet been set on the %s. Please ensure _construct_finalize() was called', 'event_espresso'), get_class($this)));
70
+		}
71
+		return $this->_model;
72
+	}
73 73
 
74
-    /**
75
-     * Returns the action this restriction generator will generate restrictions for.
76
-     * It should be one of EEM_Base::valid_cap_contexts()
77
-     *
78
-     * @throws EE_Error
79
-     * @return string
80
-     */
81
-    public function action()
82
-    {
83
-        if (! $this->_action) {
84
-            throw new EE_Error(sprintf(__('Cannot generate capability restrictions because model has not yet been set on the %s. Please ensure _construct_finalize() was called', 'event_espresso'), get_class($this)));
85
-        }
86
-        return $this->_action;
87
-    }
74
+	/**
75
+	 * Returns the action this restriction generator will generate restrictions for.
76
+	 * It should be one of EEM_Base::valid_cap_contexts()
77
+	 *
78
+	 * @throws EE_Error
79
+	 * @return string
80
+	 */
81
+	public function action()
82
+	{
83
+		if (! $this->_action) {
84
+			throw new EE_Error(sprintf(__('Cannot generate capability restrictions because model has not yet been set on the %s. Please ensure _construct_finalize() was called', 'event_espresso'), get_class($this)));
85
+		}
86
+		return $this->_action;
87
+	}
88 88
 
89
-    /**
90
-     * Returns whether or not _construct_finalize() has been called on this restriction generator object
91
-     * @return boolean
92
-     */
93
-    public function construction_finalized()
94
-    {
95
-        if ($this->_model instanceof EEM_Base  && $this->_action) {
96
-            return true;
97
-        } else {
98
-            return false;
99
-        }
100
-    }
89
+	/**
90
+	 * Returns whether or not _construct_finalize() has been called on this restriction generator object
91
+	 * @return boolean
92
+	 */
93
+	public function construction_finalized()
94
+	{
95
+		if ($this->_model instanceof EEM_Base  && $this->_action) {
96
+			return true;
97
+		} else {
98
+			return false;
99
+		}
100
+	}
101 101
 
102
-    /**
103
-     * Gets the capability restrictions generated by this object. Caches them in
104
-     * case they are required for subsequent requests
105
-     * @return array @see EEM_Base::_cap_restrictions
106
-     */
107
-    public function generate_restrictions()
108
-    {
109
-        if ($this->_cap_restrictions_generated === false) {
110
-            $this->_cap_restrictions_generated = apply_filters('FHEE__EE_Restriction_Generator_Base__generate_restrictions__first_time', $this->_generate_restrictions(), $this);
111
-        }
112
-        return apply_filters('FHEE__EE_Restriction_Generator_Base__generate_restrictions__every_time', $this->_cap_restrictions_generated, $this);
113
-    }
102
+	/**
103
+	 * Gets the capability restrictions generated by this object. Caches them in
104
+	 * case they are required for subsequent requests
105
+	 * @return array @see EEM_Base::_cap_restrictions
106
+	 */
107
+	public function generate_restrictions()
108
+	{
109
+		if ($this->_cap_restrictions_generated === false) {
110
+			$this->_cap_restrictions_generated = apply_filters('FHEE__EE_Restriction_Generator_Base__generate_restrictions__first_time', $this->_generate_restrictions(), $this);
111
+		}
112
+		return apply_filters('FHEE__EE_Restriction_Generator_Base__generate_restrictions__every_time', $this->_cap_restrictions_generated, $this);
113
+	}
114 114
 
115
-    /**
116
-     * Provided with the model, and using global knowledge about what capabilities exist,
117
-     * generates an array for use in one of the sub-arrays in EEM_Base::_cap_restrictions,
118
-     * where keys are capability names, and values are children of EE_Default_Where_Conditions
119
-     * @return array @see EEM_Base::_cap_restrictions
120
-     */
121
-    abstract protected function _generate_restrictions();
115
+	/**
116
+	 * Provided with the model, and using global knowledge about what capabilities exist,
117
+	 * generates an array for use in one of the sub-arrays in EEM_Base::_cap_restrictions,
118
+	 * where keys are capability names, and values are children of EE_Default_Where_Conditions
119
+	 * @return array @see EEM_Base::_cap_restrictions
120
+	 */
121
+	abstract protected function _generate_restrictions();
122 122
 
123
-    /**
124
-     * Whether or not this restriction generator has already done its job of
125
-     * making restrictions and caching them on itself in case its asked later
126
-     * @return boolean
127
-     */
128
-    public function has_generated_cap_restrictions()
129
-    {
130
-        if ($this->_cap_restrictions_generated === false) {
131
-            return false;
132
-        } else {
133
-            return true;
134
-        }
135
-    }
123
+	/**
124
+	 * Whether or not this restriction generator has already done its job of
125
+	 * making restrictions and caching them on itself in case its asked later
126
+	 * @return boolean
127
+	 */
128
+	public function has_generated_cap_restrictions()
129
+	{
130
+		if ($this->_cap_restrictions_generated === false) {
131
+			return false;
132
+		} else {
133
+			return true;
134
+		}
135
+	}
136 136
 
137
-    /**
138
-     * Given an action like 'edit' generates the cap name based off
139
-     * the EEM_Base::_cap_slug, which for events would be 'events', to generate the
140
-     * cap name like 'ee_edit_events'.
141
-     * If a $qualifier is passed,
142
-     * @param EEM_Base $model
143
-     * @param string $action
144
-     * @return string
145
-     */
146
-    public static function get_cap_name($model, $action)
147
-    {
148
-        return apply_filters('FHEE__EE_Restriction_Generator__get_cap_name', ( $model->is_wp_core_model() ? '' : 'ee_' ) . $action . '_' . $model->cap_slug(), $model, $action);
149
-    }
137
+	/**
138
+	 * Given an action like 'edit' generates the cap name based off
139
+	 * the EEM_Base::_cap_slug, which for events would be 'events', to generate the
140
+	 * cap name like 'ee_edit_events'.
141
+	 * If a $qualifier is passed,
142
+	 * @param EEM_Base $model
143
+	 * @param string $action
144
+	 * @return string
145
+	 */
146
+	public static function get_cap_name($model, $action)
147
+	{
148
+		return apply_filters('FHEE__EE_Restriction_Generator__get_cap_name', ( $model->is_wp_core_model() ? '' : 'ee_' ) . $action . '_' . $model->cap_slug(), $model, $action);
149
+	}
150 150
 
151
-    /**
152
-     * Checks if there is a cap for this model and this action
153
-     * @param EEM_Base $model
154
-     * @param string $action
155
-     * @return boolean
156
-     */
157
-    public static function is_cap($model, $action)
158
-    {
159
-        $caps_for_admin = EE_Registry::instance()->CAP->get_ee_capabilities('administrator');
160
-        if (in_array(self::get_cap_name($model, $action), $caps_for_admin)) {
161
-            return true;
162
-        } else {
163
-            return false;
164
-        }
165
-    }
151
+	/**
152
+	 * Checks if there is a cap for this model and this action
153
+	 * @param EEM_Base $model
154
+	 * @param string $action
155
+	 * @return boolean
156
+	 */
157
+	public static function is_cap($model, $action)
158
+	{
159
+		$caps_for_admin = EE_Registry::instance()->CAP->get_ee_capabilities('administrator');
160
+		if (in_array(self::get_cap_name($model, $action), $caps_for_admin)) {
161
+			return true;
162
+		} else {
163
+			return false;
164
+		}
165
+	}
166 166
 
167
-    /**
168
-     * Returns the default capability used to determine if the current user can
169
-     * access something.
170
-     * @return string
171
-     */
172
-    public static function get_default_restrictions_cap()
173
-    {
174
-        return apply_filters('FHEE__EE_Restriction_Generator_Base__default_restrictions_cap', 'manage_options');
175
-    }
167
+	/**
168
+	 * Returns the default capability used to determine if the current user can
169
+	 * access something.
170
+	 * @return string
171
+	 */
172
+	public static function get_default_restrictions_cap()
173
+	{
174
+		return apply_filters('FHEE__EE_Restriction_Generator_Base__default_restrictions_cap', 'manage_options');
175
+	}
176 176
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function model()
67 67
     {
68
-        if (! $this->_model instanceof EEM_Base) {
68
+        if ( ! $this->_model instanceof EEM_Base) {
69 69
             throw new EE_Error(sprintf(__('Cannot generate capability restrictions because model has not yet been set on the %s. Please ensure _construct_finalize() was called', 'event_espresso'), get_class($this)));
70 70
         }
71 71
         return $this->_model;
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      */
81 81
     public function action()
82 82
     {
83
-        if (! $this->_action) {
83
+        if ( ! $this->_action) {
84 84
             throw new EE_Error(sprintf(__('Cannot generate capability restrictions because model has not yet been set on the %s. Please ensure _construct_finalize() was called', 'event_espresso'), get_class($this)));
85 85
         }
86 86
         return $this->_action;
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      */
93 93
     public function construction_finalized()
94 94
     {
95
-        if ($this->_model instanceof EEM_Base  && $this->_action) {
95
+        if ($this->_model instanceof EEM_Base && $this->_action) {
96 96
             return true;
97 97
         } else {
98 98
             return false;
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     public static function get_cap_name($model, $action)
147 147
     {
148
-        return apply_filters('FHEE__EE_Restriction_Generator__get_cap_name', ( $model->is_wp_core_model() ? '' : 'ee_' ) . $action . '_' . $model->cap_slug(), $model, $action);
148
+        return apply_filters('FHEE__EE_Restriction_Generator__get_cap_name', ($model->is_wp_core_model() ? '' : 'ee_').$action.'_'.$model->cap_slug(), $model, $action);
149 149
     }
150 150
 
151 151
     /**
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Restriction_Generator_Public.strategy.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -12,70 +12,70 @@
 block discarded – undo
12 12
  */
13 13
 class EE_Restriction_Generator_Public extends EE_Restriction_Generator_Base
14 14
 {
15
-    protected function _generate_restrictions()
16
-    {
17
-        // if there are no standard caps for this model, then for allow full access
18
-        if (! $this->model()->cap_slug()) {
19
-            return array(
20
-            );
21
-        }
15
+	protected function _generate_restrictions()
16
+	{
17
+		// if there are no standard caps for this model, then for allow full access
18
+		if (! $this->model()->cap_slug()) {
19
+			return array(
20
+			);
21
+		}
22 22
 
23
-        $restrictions = array();
24
-        // does the basic cap exist? (eg 'ee_read_registrations')
25
-        if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action())) {
26
-            if ($this->model() instanceof EEM_CPT_Base) {
27
-                $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions(
28
-                    array( 'status' => 'publish' )
29
-                );
30
-            } elseif ($this->model() instanceof EEM_Soft_Delete_Base) {
31
-                $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions(
32
-                    array( $this->model()->deleted_field_name() => false )
33
-                );
34
-            } else {
35
-                // don't impose any restrictions if they don't have the basic reading cap
36
-            }
37
-            // does the others cap exist? (eg 'ee_read_others_registrations')
38
-            if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others')) {// both caps exist
39
-                if ($this->model() instanceof EEM_CPT_Base) {
40
-                    // then if they don't have the others cap, AT MOST show them their own and other published ones
41
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions(
42
-                        array(
43
-                            'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array(
44
-                                EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder,
45
-                                'status' => 'publish'
46
-                            )
47
-                        )
48
-                    );
49
-                } elseif ($this->model() instanceof EEM_Soft_Delete_Base) {
50
-                    // then if they don't have the other cap, AT MOST show them their own or non deleted ones
51
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions(
52
-                        array(
53
-                            'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array(
54
-                                EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder,
55
-                                $this->model()->deleted_field_name() => false
56
-                            )
57
-                        )
58
-                    );
59
-                } else {
60
-                    // again, if they don't have the others cap, continue showing all because there are no inherently hidden ones
61
-                }
62
-                // does the private cap exist (eg 'ee_read_others_private_events')
63
-                if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_private') && $this->model() instanceof EEM_CPT_Base) {
64
-                    // if they have basic and others, but not private, restrict them to see theirs and others' that aren't private
65
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') ] = new EE_Default_Where_Conditions(
66
-                        array(
67
-                            'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') => array(
68
-                                EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder,
69
-                                'status' => array( '!=', 'private' )
70
-                            )
71
-                        )
72
-                    );
73
-                }
74
-            }
75
-        } else {
76
-            // there is no basic cap. So allow full access
77
-            $restrictions = array();
78
-        }
79
-        return $restrictions;
80
-    }
23
+		$restrictions = array();
24
+		// does the basic cap exist? (eg 'ee_read_registrations')
25
+		if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action())) {
26
+			if ($this->model() instanceof EEM_CPT_Base) {
27
+				$restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions(
28
+					array( 'status' => 'publish' )
29
+				);
30
+			} elseif ($this->model() instanceof EEM_Soft_Delete_Base) {
31
+				$restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions(
32
+					array( $this->model()->deleted_field_name() => false )
33
+				);
34
+			} else {
35
+				// don't impose any restrictions if they don't have the basic reading cap
36
+			}
37
+			// does the others cap exist? (eg 'ee_read_others_registrations')
38
+			if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others')) {// both caps exist
39
+				if ($this->model() instanceof EEM_CPT_Base) {
40
+					// then if they don't have the others cap, AT MOST show them their own and other published ones
41
+					$restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions(
42
+						array(
43
+							'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array(
44
+								EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder,
45
+								'status' => 'publish'
46
+							)
47
+						)
48
+					);
49
+				} elseif ($this->model() instanceof EEM_Soft_Delete_Base) {
50
+					// then if they don't have the other cap, AT MOST show them their own or non deleted ones
51
+					$restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions(
52
+						array(
53
+							'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array(
54
+								EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder,
55
+								$this->model()->deleted_field_name() => false
56
+							)
57
+						)
58
+					);
59
+				} else {
60
+					// again, if they don't have the others cap, continue showing all because there are no inherently hidden ones
61
+				}
62
+				// does the private cap exist (eg 'ee_read_others_private_events')
63
+				if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_private') && $this->model() instanceof EEM_CPT_Base) {
64
+					// if they have basic and others, but not private, restrict them to see theirs and others' that aren't private
65
+					$restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') ] = new EE_Default_Where_Conditions(
66
+						array(
67
+							'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') => array(
68
+								EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder,
69
+								'status' => array( '!=', 'private' )
70
+							)
71
+						)
72
+					);
73
+				}
74
+			}
75
+		} else {
76
+			// there is no basic cap. So allow full access
77
+			$restrictions = array();
78
+		}
79
+		return $restrictions;
80
+	}
81 81
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     protected function _generate_restrictions()
16 16
     {
17 17
         // if there are no standard caps for this model, then for allow full access
18
-        if (! $this->model()->cap_slug()) {
18
+        if ( ! $this->model()->cap_slug()) {
19 19
             return array(
20 20
             );
21 21
         }
@@ -24,23 +24,23 @@  discard block
 block discarded – undo
24 24
         // does the basic cap exist? (eg 'ee_read_registrations')
25 25
         if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action())) {
26 26
             if ($this->model() instanceof EEM_CPT_Base) {
27
-                $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions(
28
-                    array( 'status' => 'publish' )
27
+                $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action())] = new EE_Default_Where_Conditions(
28
+                    array('status' => 'publish')
29 29
                 );
30 30
             } elseif ($this->model() instanceof EEM_Soft_Delete_Base) {
31
-                $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) ] = new EE_Default_Where_Conditions(
32
-                    array( $this->model()->deleted_field_name() => false )
31
+                $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action())] = new EE_Default_Where_Conditions(
32
+                    array($this->model()->deleted_field_name() => false)
33 33
                 );
34 34
             } else {
35 35
                 // don't impose any restrictions if they don't have the basic reading cap
36 36
             }
37 37
             // does the others cap exist? (eg 'ee_read_others_registrations')
38
-            if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_others')) {// both caps exist
38
+            if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action().'_others')) {// both caps exist
39 39
                 if ($this->model() instanceof EEM_CPT_Base) {
40 40
                     // then if they don't have the others cap, AT MOST show them their own and other published ones
41
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions(
41
+                    $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others')] = new EE_Default_Where_Conditions(
42 42
                         array(
43
-                            'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array(
43
+                            'OR*'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others') => array(
44 44
                                 EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder,
45 45
                                 'status' => 'publish'
46 46
                             )
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
                     );
49 49
                 } elseif ($this->model() instanceof EEM_Soft_Delete_Base) {
50 50
                     // then if they don't have the other cap, AT MOST show them their own or non deleted ones
51
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') ] = new EE_Default_Where_Conditions(
51
+                    $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others')] = new EE_Default_Where_Conditions(
52 52
                         array(
53
-                            'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_others') => array(
53
+                            'OR*'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_others') => array(
54 54
                                 EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder,
55 55
                                 $this->model()->deleted_field_name() => false
56 56
                             )
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
                     // again, if they don't have the others cap, continue showing all because there are no inherently hidden ones
61 61
                 }
62 62
                 // does the private cap exist (eg 'ee_read_others_private_events')
63
-                if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action() . '_private') && $this->model() instanceof EEM_CPT_Base) {
63
+                if (EE_Restriction_Generator_Base::is_cap($this->model(), $this->action().'_private') && $this->model() instanceof EEM_CPT_Base) {
64 64
                     // if they have basic and others, but not private, restrict them to see theirs and others' that aren't private
65
-                    $restrictions[ EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') ] = new EE_Default_Where_Conditions(
65
+                    $restrictions[EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_private')] = new EE_Default_Where_Conditions(
66 66
                         array(
67
-                            'OR*' . EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action() . '_private') => array(
67
+                            'OR*'.EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action().'_private') => array(
68 68
                                 EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder,
69
-                                'status' => array( '!=', 'private' )
69
+                                'status' => array('!=', 'private')
70 70
                             )
71 71
                         )
72 72
                     );
Please login to merge, or discard this patch.
strategies/EE_Restriction_Generator_Taxonomy_Protected.strategy.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -13,40 +13,40 @@
 block discarded – undo
13 13
 class EE_Restriction_Generator_Taxonomy_Protected extends EE_Restriction_Generator_Base
14 14
 {
15 15
 
16
-    /**
17
-     * Model chain/path to taxonomy model, including the term_taxonomy model itself
18
-     * @var string
19
-     */
20
-    protected $_path_to_taxonomy_model;
21
-    /**
22
-     *
23
-     * @param string $path_to_taxonomy_model Model chain/path to taxonomy model, including the term_taxonomy model itself
24
-     */
25
-    public function __construct($path_to_taxonomy_model)
26
-    {
27
-        if ($path_to_taxonomy_model !== '' && substr($path_to_taxonomy_model, -1, 1) != '.') {
28
-            $path_to_taxonomy_model .= '.';
29
-        }
30
-        $this->_path_to_taxonomy_model = $path_to_taxonomy_model;
31
-    }
32
-    protected function _generate_restrictions()
33
-    {
34
-        // if there are no standard caps for this model, then for allow full access
35
-        if (! $this->model()->cap_slug()) {
36
-            return array(
37
-            );
38
-        }
16
+	/**
17
+	 * Model chain/path to taxonomy model, including the term_taxonomy model itself
18
+	 * @var string
19
+	 */
20
+	protected $_path_to_taxonomy_model;
21
+	/**
22
+	 *
23
+	 * @param string $path_to_taxonomy_model Model chain/path to taxonomy model, including the term_taxonomy model itself
24
+	 */
25
+	public function __construct($path_to_taxonomy_model)
26
+	{
27
+		if ($path_to_taxonomy_model !== '' && substr($path_to_taxonomy_model, -1, 1) != '.') {
28
+			$path_to_taxonomy_model .= '.';
29
+		}
30
+		$this->_path_to_taxonomy_model = $path_to_taxonomy_model;
31
+	}
32
+	protected function _generate_restrictions()
33
+	{
34
+		// if there are no standard caps for this model, then for allow full access
35
+		if (! $this->model()->cap_slug()) {
36
+			return array(
37
+			);
38
+		}
39 39
 
40
-        return array(
41
-            'ee_manage_event_categories' => new EE_Default_Where_Conditions(array(
42
-                $this->_path_to_taxonomy_model . 'taxonomy*no_ee_manage_event_categories' => array( '!=', 'espresso_event_categories' )
43
-            )),
44
-            'ee_manage_venue_categories' => new EE_Default_Where_Conditions(array(
45
-                $this->_path_to_taxonomy_model . 'taxonomy*no_ee_manage_venue_categories' => array( '!=', 'espresso_venue_categories' )
46
-            )),
47
-            'ee_manage_event_types' => new EE_Default_Where_Conditions(array(
48
-                $this->_path_to_taxonomy_model . 'taxonomy*ee_manage_event_types' => array( '!=', 'espresso_event_types' )
49
-            )),
50
-        );
51
-    }
40
+		return array(
41
+			'ee_manage_event_categories' => new EE_Default_Where_Conditions(array(
42
+				$this->_path_to_taxonomy_model . 'taxonomy*no_ee_manage_event_categories' => array( '!=', 'espresso_event_categories' )
43
+			)),
44
+			'ee_manage_venue_categories' => new EE_Default_Where_Conditions(array(
45
+				$this->_path_to_taxonomy_model . 'taxonomy*no_ee_manage_venue_categories' => array( '!=', 'espresso_venue_categories' )
46
+			)),
47
+			'ee_manage_event_types' => new EE_Default_Where_Conditions(array(
48
+				$this->_path_to_taxonomy_model . 'taxonomy*ee_manage_event_types' => array( '!=', 'espresso_event_types' )
49
+			)),
50
+		);
51
+	}
52 52
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,20 +32,20 @@
 block discarded – undo
32 32
     protected function _generate_restrictions()
33 33
     {
34 34
         // if there are no standard caps for this model, then for allow full access
35
-        if (! $this->model()->cap_slug()) {
35
+        if ( ! $this->model()->cap_slug()) {
36 36
             return array(
37 37
             );
38 38
         }
39 39
 
40 40
         return array(
41 41
             'ee_manage_event_categories' => new EE_Default_Where_Conditions(array(
42
-                $this->_path_to_taxonomy_model . 'taxonomy*no_ee_manage_event_categories' => array( '!=', 'espresso_event_categories' )
42
+                $this->_path_to_taxonomy_model.'taxonomy*no_ee_manage_event_categories' => array('!=', 'espresso_event_categories')
43 43
             )),
44 44
             'ee_manage_venue_categories' => new EE_Default_Where_Conditions(array(
45
-                $this->_path_to_taxonomy_model . 'taxonomy*no_ee_manage_venue_categories' => array( '!=', 'espresso_venue_categories' )
45
+                $this->_path_to_taxonomy_model.'taxonomy*no_ee_manage_venue_categories' => array('!=', 'espresso_venue_categories')
46 46
             )),
47 47
             'ee_manage_event_types' => new EE_Default_Where_Conditions(array(
48
-                $this->_path_to_taxonomy_model . 'taxonomy*ee_manage_event_types' => array( '!=', 'espresso_event_types' )
48
+                $this->_path_to_taxonomy_model.'taxonomy*ee_manage_event_types' => array('!=', 'espresso_event_types')
49 49
             )),
50 50
         );
51 51
     }
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Return_None_Where_Conditions.strategy.php 2 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@
 block discarded – undo
12 12
  */
13 13
 class EE_Return_None_Where_Conditions extends EE_Default_Where_Conditions
14 14
 {
15
-    protected function _get_default_where_conditions()
16
-    {
17
-        if ($this->_model->has_primary_key_field()) {
18
-            return array( $this->_model->primary_key_name() => array('<', 0 ) );
19
-        } else {
20
-            $fk_field = $this->_model->get_a_field_of_type('EE_Foreign_Key_Field_Base');
21
-            return array( 'AND*impossible' => array( $fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL' ) );
22
-        }
23
-    }
15
+	protected function _get_default_where_conditions()
16
+	{
17
+		if ($this->_model->has_primary_key_field()) {
18
+			return array( $this->_model->primary_key_name() => array('<', 0 ) );
19
+		} else {
20
+			$fk_field = $this->_model->get_a_field_of_type('EE_Foreign_Key_Field_Base');
21
+			return array( 'AND*impossible' => array( $fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL' ) );
22
+		}
23
+	}
24 24
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@
 block discarded – undo
15 15
     protected function _get_default_where_conditions()
16 16
     {
17 17
         if ($this->_model->has_primary_key_field()) {
18
-            return array( $this->_model->primary_key_name() => array('<', 0 ) );
18
+            return array($this->_model->primary_key_name() => array('<', 0));
19 19
         } else {
20 20
             $fk_field = $this->_model->get_a_field_of_type('EE_Foreign_Key_Field_Base');
21
-            return array( 'AND*impossible' => array( $fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL' ) );
21
+            return array('AND*impossible' => array($fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL'));
22 22
         }
23 23
     }
24 24
 }
Please login to merge, or discard this patch.
core/db_models/strategies/EE_Restriction_Generator_WP_User.strategy.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,18 +15,18 @@
 block discarded – undo
15 15
 class EE_Restriction_Generator_WP_User extends EE_Restriction_Generator_Base
16 16
 {
17 17
 
18
-    /**
19
-     * @return \EE_Default_Where_Conditions
20
-     */
21
-    protected function _generate_restrictions()
22
-    {
18
+	/**
19
+	 * @return \EE_Default_Where_Conditions
20
+	 */
21
+	protected function _generate_restrictions()
22
+	{
23 23
 
24
-        return array(
25
-            // if they can't access users, they can still access themselves
26
-            EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) => new EE_Default_Where_Conditions(array(
27
-                EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder
28
-            )),
24
+		return array(
25
+			// if they can't access users, they can still access themselves
26
+			EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) => new EE_Default_Where_Conditions(array(
27
+				EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder
28
+			)),
29 29
 
30
-        );
31
-    }
30
+		);
31
+	}
32 32
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Question_Option.model.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -11,39 +11,39 @@
 block discarded – undo
11 11
 class EEM_Question_Option extends EEM_Soft_Delete_Base
12 12
 {
13 13
 
14
-    // private instance of the Attendee object
15
-    protected static $_instance = null;
14
+	// private instance of the Attendee object
15
+	protected static $_instance = null;
16 16
 
17
-    protected function __construct($timezone = null)
18
-    {
19
-        $this->singular_item = __('Question Option', 'event_espresso');
20
-        $this->plural_item = __('Question Options', 'event_espresso');
17
+	protected function __construct($timezone = null)
18
+	{
19
+		$this->singular_item = __('Question Option', 'event_espresso');
20
+		$this->plural_item = __('Question Options', 'event_espresso');
21 21
 
22
-        $this->_tables = array(
23
-            'Question_Option'=>new EE_Primary_Table('esp_question_option', 'QSO_ID')
24
-        );
25
-        $this->_fields = array(
26
-            'Question_Option'=>array(
27
-                    'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID', 'event_espresso')),
28
-                    'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'),
29
-                    'QSO_value'=>new EE_Plain_Text_Field('QSO_value', __("Question Option Value", "event_espresso"), false, ''),
30
-                    'QSO_desc'=>new EE_Post_Content_Field('QSO_desc', __('Question Option Description', 'event_espresso'), false, ''),
31
-                    'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso'), false, 0),
32
-                    'QSO_system'=>new EE_Plain_Text_Field('QSO_system', __('Internal string ID for question option', 'event_espresso'), true, null),
33
-                    'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed', 'event_espresso'), false, false)
34
-                )
35
-        );
36
-        $this->_model_relations = array(
37
-            'Question'=>new EE_Belongs_To_Relation()
38
-        );
22
+		$this->_tables = array(
23
+			'Question_Option'=>new EE_Primary_Table('esp_question_option', 'QSO_ID')
24
+		);
25
+		$this->_fields = array(
26
+			'Question_Option'=>array(
27
+					'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID', 'event_espresso')),
28
+					'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'),
29
+					'QSO_value'=>new EE_Plain_Text_Field('QSO_value', __("Question Option Value", "event_espresso"), false, ''),
30
+					'QSO_desc'=>new EE_Post_Content_Field('QSO_desc', __('Question Option Description', 'event_espresso'), false, ''),
31
+					'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso'), false, 0),
32
+					'QSO_system'=>new EE_Plain_Text_Field('QSO_system', __('Internal string ID for question option', 'event_espresso'), true, null),
33
+					'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed', 'event_espresso'), false, false)
34
+				)
35
+		);
36
+		$this->_model_relations = array(
37
+			'Question'=>new EE_Belongs_To_Relation()
38
+		);
39 39
 
40
-        $this->_model_chain_to_wp_user = 'Question';
41
-        // this model is generally available for reading
42
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
43
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QSO_system');
44
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QSO_system');
45
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QSO_system');
46
-        $this->_caps_slug = 'questions';
47
-        parent::__construct($timezone);
48
-    }
40
+		$this->_model_chain_to_wp_user = 'Question';
41
+		// this model is generally available for reading
42
+		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
43
+		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QSO_system');
44
+		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QSO_system');
45
+		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QSO_system');
46
+		$this->_caps_slug = 'questions';
47
+		parent::__construct($timezone);
48
+	}
49 49
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,10 +39,10 @@
 block discarded – undo
39 39
 
40 40
         $this->_model_chain_to_wp_user = 'Question';
41 41
         // this model is generally available for reading
42
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
43
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QSO_system');
44
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QSO_system');
45
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QSO_system');
42
+        $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
43
+        $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QSO_system');
44
+        $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QSO_system');
45
+        $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QSO_system');
46 46
         $this->_caps_slug = 'questions';
47 47
         parent::__construct($timezone);
48 48
     }
Please login to merge, or discard this patch.