<p>I found a solution to change the allowed asset sources in redactor.</p>

<p>If you like to change the allowed asset sources global without making any difference between users/groups, than you can use the following steps:</p>

<ol>
<li>Open the javascript file "/craft/app/resources/js/RichTextInput.js"</li>
<li>Add the following code on line 100: "sources: ['folder:1', 'folder:2']," (the id's represents your asset source ids)</li>
<li>Replace the file "/craft/app/resources/js/compress/RichTextInput.js" with your file (optional: for better performance compress the javscript file after replacing)</li>
<li>Refresh your craft dashboard in the browser</li>
</ol>

<p>The second option would be to include a second, modified RichTextInput.js File in Craft backend. So it would be possible to write a plugin checking the "View" rights of the user and set the asset sources in the javascript dynamically. </p>

<p>Notice: I have tested to include the same, modified file a second time and was able to overwrite the assets sources in this way, but i did not wrote any plugin yet. </p>

<p>Please note: </p>

<ul>
<li>A craft update could update also update the RichTextInput.js file - so you should test the functionality after each update.</li>
<li>It's not a real "permission" check, it only hide/show asset sources</li>
<li>The solution is only testet with local asset sources (but should work with other as well)</li>
</ul>

<p>And finally: I know, the solution is really <strong>quick and dirty</strong>, but better than nothing... I hope a Craft update coming soon and brings a real solution for this issue.</p>

CC BY-SA 3.0
2015-06-15T17:14:02.523Z
2015-06-15T17:14:02.523Z
Tom Bauer
<p>There is no native way to limit which sources appear in the asset window. I imagine it can be accomplished with a custom field type. This would be a great feature for future releases; I recommend adding it to the <a href="http://feedback.buildwithcraft.com/forums/285221-feature-requests" rel="nofollow">Feature Requests forum</a>.  </p>

CC BY-SA 3.0
2015-06-15T02:39:47.443Z
Just took a look, and it appears someone (maybe you?!) has already made this request. Go vote! http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/8410410-better-asset-permissions-on-asset-fields-etc
Aaron Berkowitz
CC BY-SA 3.0
2015-06-15T04:51:04.047Z
Thx. Just added my vote to the feature request.
Tom Bauer
CC BY-SA 3.0
2015-06-15T02:33:46.070Z
2015-06-15T02:33:46.070Z
Aaron Berkowitz
<p>I have created several asset sources in craft and now i created user groups, with different view rights to this sources. When a user with restricted rights goes to the "assets" tab in craft, the rights management works as excepted: the user only see assets sources, where he has access to. But in redactor wysiwyg editor, using the insert image button or link to a asset function, it shows always all asset sources, even if the user has no view access to. Is there a way to restrict this list, based on users "view" permissions?  Maybe i missed it and there is something like a global config option (for example: restrictAssetsInRedactor = true)?</p>

<p>When i look in firebug, i see, that the modal window is called without any sources. Is there a way to modify/overwrite this call with a custom plugin?</p>

<p><img src="https://i.sstatic.net/qtbFs.png" alt="Post variables of modal window in redactor"></p>

<assets><redactor><user-groups>
Restricted access to assets in Redactor
# Restricted access to assets in Redactor

(Asked by: username_0 on 2015-06-13)

I have created several asset sources in craft and now i created user groups, with different view rights to this sources. When a user with restricted rights goes to the "assets" tab in craft, the rights management works as excepted: the user only see assets sources, where he has access to. But in redactor wysiwyg editor, using the insert image button or link to a asset function, it shows always all asset sources, even if the user has no view access to. Is there a way to restrict this list, based on users "view" permissions? Maybe i missed it and there is something like a global config option (for example: restrictAssetsInRedactor = true)?

When i look in firebug, i see, that the modal window is called without any sources. Is there a way to modify/overwrite this call with a custom plugin?

![Post variables of modal window in redactor](https://i.sstatic.net/qtbFs.png)

**Tags:** assets, redactor, user-groups

---

## 2 answers

### Answer by username_1 on 2015-06-15. Score: 4 | Accepted answer

There is no native way to limit which sources appear in the asset window. I imagine it can be accomplished with a custom field type. This would be a great feature for future releases; I recommend adding it to the [Feature Requests forum](http://feedback.buildwithcraft.com/forums/285221-feature-requests).

> **Comments:**
> **username_1**: Just took a look, and it appears someone (maybe you?!) has already made this request. Go vote! http://feedback.buildwithcraft.com/forums/285221-feature-requests/suggestions/8410410-better-asset-permissions-on-asset-fields-etc  
> **username_0**: Thx. Just added my vote to the feature request.  

---

### Answer by username_0 on 2015-06-15. Score: 2

I found a solution to change the allowed asset sources in redactor.

If you like to change the allowed asset sources global without making any difference between users/groups, than you can use the following steps:

1. Open the javascript file "/craft/app/resources/js/RichTextInput.js"
2. Add the following code on line 100: "sources: ['folder:1', 'folder:2']," (the id's represents your asset source ids)
3. Replace the file "/craft/app/resources/js/compress/RichTextInput.js" with your file (optional: for better performance compress the javscript file after replacing)
4. Refresh your craft dashboard in the browser

The second option would be to include a second, modified RichTextInput.js File in Craft backend. So it would be possible to write a plugin checking the "View" rights of the user and set the asset sources in the javascript dynamically.

Notice: I have tested to include the same, modified file a second time and was able to overwrite the assets sources in this way, but i did not wrote any plugin yet.

Please note:

* A craft update could update also update the RichTextInput.js file - so you should test the functionality after each update.
* It's not a real "permission" check, it only hide/show asset sources
* The solution is only testet with local asset sources (but should work with other as well)

And finally: I know, the solution is really **quick and dirty**, but better than nothing... I hope a Craft update coming soon and brings a real solution for this issue.


---

