I've a problem with checking permissions on a node.
I've made a custom documentcontroller for a newsitem. When the backoffice user is logged in, i would like to show a button at the frontend to edit the message. When i login at the backoffice with a useraccount which doesn't show the node in contenttree, the "permission.AssignedPermissions" in the code below always contains "C" (and F,D,U,O,M and S). It doesn't matter which nodeId i'm using, it always returns these permissions.
public class NewsitemController : Umbraco.Web.Mvc.RenderMvcController
{
public ActionResult Edit(RenderModel model)
{
bool canCreateNode = false;
var userTicket = new System.Web.HttpContextWrapper(System.Web.HttpContext.Current).GetUmbracoAuthTicket();
if (userTicket != null)
{
var us = Services.UserService;
var user = us.GetByUsername(userTicket.Name);
if (user != null)
{
var userPermissions = us.GetPermissions(user, new Int32[]{model.Content.Id});
foreach (var permission in userPermissions)
{
if (permission.AssignedPermissions.Contains("C"))
{
canCreateNode = true;
}
}
if (canCreateNode == true)
{
.....
}
}
}
return Redirect(model.Content.Url);
}
The user is assigned to 1 group which has permission to 1 node which is not a newsitem. What can be the reason that GetPermissions returns the same permissions for every node?
GetPermissions always returns "Create"-permission
Hi everybody,
I've a problem with checking permissions on a node. I've made a custom documentcontroller for a newsitem. When the backoffice user is logged in, i would like to show a button at the frontend to edit the message. When i login at the backoffice with a useraccount which doesn't show the node in contenttree, the "permission.AssignedPermissions" in the code below always contains "C" (and F,D,U,O,M and S). It doesn't matter which nodeId i'm using, it always returns these permissions.
I've uses this documentation https://our.umbraco.org/documentation/extending/section-trees/tree-actions#tree-actions
The user is assigned to 1 group which has permission to 1 node which is not a newsitem. What can be the reason that GetPermissions returns the same permissions for every node?
iNETZO
is working on a reply...