Skip to content

Commit 082197b

Browse files
committed
version 0.1.4
1 parent 6c853c8 commit 082197b

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

changelog.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
[
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+
},
211
{
312
"version": "0.1.3",
413
"downloadUrl": "https://github.com/engram-design/ImageResizer/archive/0.1.3.zip",

imageresizer/ImageResizerPlugin.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function getName()
1414

1515
public function getVersion()
1616
{
17-
return '0.1.3';
17+
return '0.1.4';
1818
}
1919

2020
public function getSchemaVersion()
@@ -162,6 +162,24 @@ public function init()
162162

163163
public function addAssetActions()
164164
{
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+
);
166184
}
167185
}

imageresizer/controllers/ImageResizerController.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ public function actionResizeElementAction()
77
{
88
$this->requirePostRequest();
99
$this->requireAjaxRequest();
10-
$this->requireAdmin();
1110

1211
$assetIds = craft()->request->getPost('assetIds');
1312
$imageWidth = craft()->request->getPost('imageWidth');
@@ -34,7 +33,6 @@ public function actionResizeElementAction()
3433
public function actionCropElementAction()
3534
{
3635
$this->requireAjaxRequest();
37-
$this->requireAdmin();
3836

3937
$assetId = craft()->request->getRequiredPost('assetId');
4038

@@ -59,7 +57,6 @@ public function actionCropElementAction()
5957
public function actionCropSaveAction()
6058
{
6159
$this->requireAjaxRequest();
62-
$this->requireAdmin();
6360

6461
try {
6562
$x1 = craft()->request->getRequiredPost('x1');

0 commit comments

Comments
 (0)