File tree Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Original file line number Diff line number Diff line change 1
1
[
2
+ {
3
+ "version" : " 0.1.4" ,
4
+ "downloadUrl" : " https://github.com/engram-design/ImageResizer/archive/0.1.4.zip" ,
5
+ "date" : " 2016-06-29T14:22:00+10:00" ,
6
+ "notes" : [
7
+ " [Added] Permissions added for crop and resize element actions. Choose whether your users have access to these functions." ,
8
+ " [Improved] Non-admins can now crop or resize images."
9
+ ]
10
+ },
2
11
{
3
12
"version" : " 0.1.3" ,
4
13
"downloadUrl" : " https://github.com/engram-design/ImageResizer/archive/0.1.3.zip" ,
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ public function getName()
14
14
15
15
public function getVersion ()
16
16
{
17
- return '0.1.3 ' ;
17
+ return '0.1.4 ' ;
18
18
}
19
19
20
20
public function getSchemaVersion ()
@@ -162,6 +162,24 @@ public function init()
162
162
163
163
public function addAssetActions ()
164
164
{
165
- return array ('ImageResizer_ResizeImage ' , 'ImageResizer_CropImage ' );
165
+ $ actions = array ();
166
+
167
+ if (craft ()->userSession ->checkPermission ('imageResizer-cropImage ' )) {
168
+ $ actions [] = 'ImageResizer_CropImage ' ;
169
+ }
170
+
171
+ if (craft ()->userSession ->checkPermission ('imageResizer-resizeImage ' )) {
172
+ $ actions [] = 'ImageResizer_ResizeImage ' ;
173
+ }
174
+
175
+ return $ actions ;
176
+ }
177
+
178
+ public function registerUserPermissions ()
179
+ {
180
+ return array (
181
+ 'imageResizer-cropImage ' => array ('label ' => Craft::t ('Crop images ' )),
182
+ 'imageResizer-resizeImage ' => array ('label ' => Craft::t ('Resize images ' )),
183
+ );
166
184
}
167
185
}
Original file line number Diff line number Diff line change @@ -7,7 +7,6 @@ public function actionResizeElementAction()
7
7
{
8
8
$ this ->requirePostRequest ();
9
9
$ this ->requireAjaxRequest ();
10
- $ this ->requireAdmin ();
11
10
12
11
$ assetIds = craft ()->request ->getPost ('assetIds ' );
13
12
$ imageWidth = craft ()->request ->getPost ('imageWidth ' );
@@ -34,7 +33,6 @@ public function actionResizeElementAction()
34
33
public function actionCropElementAction ()
35
34
{
36
35
$ this ->requireAjaxRequest ();
37
- $ this ->requireAdmin ();
38
36
39
37
$ assetId = craft ()->request ->getRequiredPost ('assetId ' );
40
38
@@ -59,7 +57,6 @@ public function actionCropElementAction()
59
57
public function actionCropSaveAction ()
60
58
{
61
59
$ this ->requireAjaxRequest ();
62
- $ this ->requireAdmin ();
63
60
64
61
try {
65
62
$ x1 = craft ()->request ->getRequiredPost ('x1 ' );
You can’t perform that action at this time.
0 commit comments