Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Contracts\Auth\Access;
4
 
5
interface Gate
6
{
7
    /**
8
     * Determine if a given ability has been defined.
9
     *
10
     * @param  string  $ability
11
     * @return bool
12
     */
13
    public function has($ability);
14
 
15
    /**
16
     * Define a new ability.
17
     *
18
     * @param  string  $ability
19
     * @param  callable|string  $callback
20
     * @return $this
21
     */
22
    public function define($ability, $callback);
23
 
24
    /**
25
     * Define abilities for a resource.
26
     *
27
     * @param  string  $name
28
     * @param  string  $class
29
     * @param  array|null  $abilities
30
     * @return $this
31
     */
32
    public function resource($name, $class, array $abilities = null);
33
 
34
    /**
35
     * Define a policy class for a given class type.
36
     *
37
     * @param  string  $class
38
     * @param  string  $policy
39
     * @return $this
40
     */
41
    public function policy($class, $policy);
42
 
43
    /**
44
     * Register a callback to run before all Gate checks.
45
     *
46
     * @param  callable  $callback
47
     * @return $this
48
     */
49
    public function before(callable $callback);
50
 
51
    /**
52
     * Register a callback to run after all Gate checks.
53
     *
54
     * @param  callable  $callback
55
     * @return $this
56
     */
57
    public function after(callable $callback);
58
 
59
    /**
60
     * Determine if the given ability should be granted for the current user.
61
     *
62
     * @param  string  $ability
63
     * @param  array|mixed  $arguments
64
     * @return bool
65
     */
66
    public function allows($ability, $arguments = []);
67
 
68
    /**
69
     * Determine if the given ability should be denied for the current user.
70
     *
71
     * @param  string  $ability
72
     * @param  array|mixed  $arguments
73
     * @return bool
74
     */
75
    public function denies($ability, $arguments = []);
76
 
77
    /**
78
     * Determine if all of the given abilities should be granted for the current user.
79
     *
80
     * @param  iterable|string  $abilities
81
     * @param  array|mixed  $arguments
82
     * @return bool
83
     */
84
    public function check($abilities, $arguments = []);
85
 
86
    /**
87
     * Determine if any one of the given abilities should be granted for the current user.
88
     *
89
     * @param  iterable|string  $abilities
90
     * @param  array|mixed  $arguments
91
     * @return bool
92
     */
93
    public function any($abilities, $arguments = []);
94
 
95
    /**
96
     * Determine if the given ability should be granted for the current user.
97
     *
98
     * @param  string  $ability
99
     * @param  array|mixed  $arguments
100
     * @return \Illuminate\Auth\Access\Response
101
     *
102
     * @throws \Illuminate\Auth\Access\AuthorizationException
103
     */
104
    public function authorize($ability, $arguments = []);
105
 
106
    /**
107
     * Inspect the user for the given ability.
108
     *
109
     * @param  string  $ability
110
     * @param  array|mixed  $arguments
111
     * @return \Illuminate\Auth\Access\Response
112
     */
113
    public function inspect($ability, $arguments = []);
114
 
115
    /**
116
     * Get the raw result from the authorization callback.
117
     *
118
     * @param  string  $ability
119
     * @param  array|mixed  $arguments
120
     * @return mixed
121
     *
122
     * @throws \Illuminate\Auth\Access\AuthorizationException
123
     */
124
    public function raw($ability, $arguments = []);
125
 
126
    /**
127
     * Get a policy instance for a given class.
128
     *
129
     * @param  object|string  $class
130
     * @return mixed
131
     *
132
     * @throws \InvalidArgumentException
133
     */
134
    public function getPolicyFor($class);
135
 
136
    /**
137
     * Get a guard instance for the given user.
138
     *
139
     * @param  \Illuminate\Contracts\Auth\Authenticatable|mixed  $user
140
     * @return static
141
     */
142
    public function forUser($user);
143
 
144
    /**
145
     * Get all of the defined abilities.
146
     *
147
     * @return array
148
     */
149
    public function abilities();
150
}