Sorry, I mean permissions for users who are adding/editing content with the document
types. e.g. Is it possible to define which user may create content with a particular Document Type?
You can limit what content can be added in a section by document type (so for example under news archive you can limit users to only adding news articles). You can also limit users as to which sections they can add content into, using the permissions section in their user details. But the permissions aren't tied into the document types, you can either add all allowable content types under a document, or none.
It might be possible to write something that would allow you to do this, but I'd imagine that it'd be quite a big task.
We are using Umbraco v4.6.1 and I have been requested to limit some users to a specific document type. Can I do this in v 4.6.1? If not, will I be able to limit users to a specific doc type in 4.7? We are moving to v 4.7 soon.
I know this post is a little old but I was just looking into this myself and have had the idea of using the context menus and events to manage this feature.
You could maintain a lits of doc types you want to protect by role and manage the context menu to remove the create/delete/sort/move etc based on this.
Actually I now see a flaw thinking about it. It would work for items when you are on one of the doc types in question or has a parent of that type but not say at the top level of your site. I guess you would just have to remove this from the list of available doctypes in this situation.
It would be nice to be able to either get at the create dialogue or set security on the doc types.
Am i right in saying this was going to be a feature of v5?
Ok ive sussed a way of doing it. Not perfect and you would need to ensure that the functionality doesnt get zapped when you do an upgrade but heres a little hack:
Find out the UI control you need to edit using umbraco/config/create/UI.xml - in this instance its the /umbraco/create/content.ascx
Open up the user control and place method listed below at the top after the page declarations. You may need to change the test condition to a specific group but its a nice quick way to get something you need without tons of work.
A better way would be to create another user control and edit the UI.xml file to point to the new control - that way your control code wouldnt get overwritten by an umbraco update.
Maybe someone else has an even better way?
<script language="c#" runat="server">
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (!umbraco.BusinessLogic.User.GetCurrent().IsAdmin())
{
ListItem i = nodeType.Items.FindByText("YourDocType");
I actually wrote a package that does this that allows you to modify the menus for content of specific DocTypes AND specific node ids, and allows you to vary the rules by user as well.
i used the above concept and ended up with the code below in cotnent.ascx - if i want to disallow a doctype from being created by a non-admin I just put disallow in the doctype description - admins are smart enough to ignore the description text when creating the items. I'm using uSiteBuilder so I just add it in there if its something like settings or a "collection type node" like "News" that I dont want end users creating (I create it once for them).
<script language="c#" runat="server"> protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); //get the document type names into cache that are disallowed for non admins HttpContext context = HttpContext.Current; List<string> disAllowedDocNames = (context.Cache["disAllowedDocNames"] == null ? null : (context.Cache["disAllowedDocNames"] as List<string>)); if (disAllowedDocNames == null) { disAllowedDocNames = new List<string> { }; List<umbraco.cms.businesslogic.web.DocumentType> docTypes = umbraco.cms.businesslogic.web.DocumentType.GetAllAsList(); foreach (umbraco.cms.businesslogic.web.DocumentType dt in docTypes.Where(dti => dti.Description.ToLower().Contains("disallow"))) disAllowedDocNames.Add(dt.Text); context.Cache.Insert("disAllowedDocNames", disAllowedDocNames); }
if (!umbraco.BusinessLogic.User.GetCurrent().IsAdmin()) { foreach (ListItem li in nodeType.Items) { if (disAllowedDocNames.Contains(li.Text)) li.Enabled = false; } } } </script>
We had the same requirement to be able to disallow certain user types from creating specific document types. After a lot of digging and trial and error we have come up with a solution. The only downside is that it relies on hard coding of user types and doc type aliases, but as our system is now fairly well established these are not likely to change much in the future.
The workaround is in two parts. The first is to add a filter to the ng-repeat in the view where the available document types are listed (Umbraco/Views/content/create.html) as follows;
<li ng-repeat="docType in allowedTypes | filter:filteredDocTypes | orderBy:'name':false">
Next is to add the filteredDocTypes function to the contentCreateController function (Umbraco/Js/umbraco.contollers.js) to filter out disallowed doc types based on user type. Without going into too much more explanation, here is the updated contentCreateController function snippet;
In the example, users of type 'writer' will not have the option to create content of doc types ECCalendar or NewsLandingPage. It's only had a minimal amount of testing but it appears to give the desired result.
User permissions on Document Types
Hello,
Can I set user permissions on Document Types?
Thanks in advance
Do you mean permissions to add/edit document types, or permissions for users who are adding/editing content with the document types?
Sorry, I mean permissions for users who are adding/editing content with the document types.
e.g. Is it possible to define which user may create content with a particular Document Type?
I don't think that's possible out of the box.
You can limit what content can be added in a section by document type (so for example under news archive you can limit users to only adding news articles). You can also limit users as to which sections they can add content into, using the permissions section in their user details. But the permissions aren't tied into the document types, you can either add all allowable content types under a document, or none.
It might be possible to write something that would allow you to do this, but I'd imagine that it'd be quite a big task.
We are using Umbraco v4.6.1 and I have been requested to limit some users to a specific document type. Can I do this in v 4.6.1? If not, will I be able to limit users to a specific doc type in 4.7? We are moving to v 4.7 soon.
Thanx!
I know this post is a little old but I was just looking into this myself and have had the idea of using the context menus and events to manage this feature.
You could maintain a lits of doc types you want to protect by role and manage the context menu to remove the create/delete/sort/move etc based on this.
That should work shouldnt it?
Article on it here:
http://our.umbraco.org/wiki/reference/api-cheatsheet/using-applicationbase-to-register-events/event-examples/remove-context-menu-items
Actually I now see a flaw thinking about it. It would work for items when you are on one of the doc types in question or has a parent of that type but not say at the top level of your site. I guess you would just have to remove this from the list of available doctypes in this situation.
It would be nice to be able to either get at the create dialogue or set security on the doc types.
Am i right in saying this was going to be a feature of v5?
Ok ive sussed a way of doing it. Not perfect and you would need to ensure that the functionality doesnt get zapped when you do an upgrade but heres a little hack:
Find out the UI control you need to edit using umbraco/config/create/UI.xml - in this instance its the /umbraco/create/content.ascx
Open up the user control and place method listed below at the top after the page declarations. You may need to change the test condition to a specific group but its a nice quick way to get something you need without tons of work.
A better way would be to create another user control and edit the UI.xml file to point to the new control - that way your control code wouldnt get overwritten by an umbraco update.
Maybe someone else has an even better way?
Hiya,
I actually wrote a package that does this that allows you to modify the menus for content of specific DocTypes AND specific node ids, and allows you to vary the rules by user as well.
http://our.umbraco.org/projects/backoffice-extensions/attackmonkey-custom-menus
:)
i used the above concept and ended up with the code below in cotnent.ascx - if i want to disallow a doctype from being created by a non-admin I just put disallow in the doctype description - admins are smart enough to ignore the description text when creating the items. I'm using uSiteBuilder so I just add it in there if its something like settings or a "collection type node" like "News" that I dont want end users creating (I create it once for them).
hope this helps someone else out
I did a workaround here
workaround
This blocked the content editor from higher level content so they can only access what I want them to! Hope that helps - some years later! :)
Tony
We had the same requirement to be able to disallow certain user types from creating specific document types. After a lot of digging and trial and error we have come up with a solution. The only downside is that it relies on hard coding of user types and doc type aliases, but as our system is now fairly well established these are not likely to change much in the future.
The workaround is in two parts. The first is to add a filter to the ng-repeat in the view where the available document types are listed (Umbraco/Views/content/create.html) as follows;
Next is to add the filteredDocTypes function to the contentCreateController function (Umbraco/Js/umbraco.contollers.js) to filter out disallowed doc types based on user type. Without going into too much more explanation, here is the updated contentCreateController function snippet;
In the example, users of type 'writer' will not have the option to create content of doc types ECCalendar or NewsLandingPage. It's only had a minimal amount of testing but it appears to give the desired result.
This article will show you the best way to hide a document-type from create menu items.
is working on a reply...