Setting permissions

Posted by Community Admin on 04-Aug-2018 11:20

Setting permissions

All Replies

Posted by Community Admin on 24-Jul-2012 00:00

Please help me to set permissions for different roles created in sitefinity?  I logged in as admin and tried to add permissions for the new roles. But the assigned permissions are not accessile when I logged as a user in corresponding role. Why its like this? For accessing assigned permissions for new roles what should I do? (All these have to do without any code level modification)
Im a starter in sitefinity. Please help me. Im using 5.1 version

Posted by Community Admin on 25-Jul-2012 00:00

Hello,

Thank you for contacting our Support Center.

As an administrator you have full control over the roles and their permissions. You can change them in the backend of Sitefinity under Administration -> Roles. For more information you may want to refer to this article and its subsections from our documentation. For your convenience I have also recorded a short video illustrating the setting of permissions for a newly created role.

I hope you find this reply helpful. Please don't hesitate to contact us for any further questions you may have.

Regards,
Pavel Benov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 25-Jul-2012 00:00

Hi Pavel Beno,
Thank you very much for your reply.
I could set permissions for the newly created roles. But the problem is that when I logged in as a user in that specific role (newly created role), I cant access all the permissions set by administrator. That means the menu for that permission in the top will not be shown.
For example, if administrator set pemissions for a TestDesigner (a newly created role).
Say for example administrator is allowing permission for module builder. When I logged as a user in TestDesigner, the module builder will not be seen in anywhere in the dash board.

Posted by Community Admin on 25-Jul-2012 00:00

Hi,
This problem I found not only in any single item. Also in the custom modules its there.

One thing to notice that, I created a TestDesigner role and set permissions as same as the permissions set to the Designer role (already there in version 5.1). But when I logged in as a user in Designer role I can see Design under that Page Templates and Widget Templates options. But when I logged in as a user in TestDesigner role I can see Design under that only Widget Templates option.

Why its like that?? Im missing any settings anywhere??

Please help me..

Posted by Community Admin on 27-Jul-2012 00:00

Hello,

On your first question - after a thurough investigation we found out that this is a bug, so I have logged it in our system for fixing. You can follow the progress in our PITS

Thank you for bringing this to our attention, your Telerik points have been updated.

On your second question - To set permissions for a custom module you need to go to Administration->Permissions->Your Custom Module. Set the desired functionalities by clicking on Change, from the menu choose Selected roles or users -> Add roles and users

Kind regards,
Pavel Benov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 30-Jul-2012 00:00

Hi Pavel Benov,
Thank you very much for your reply. 
Please let me know What you mean by this line on your reply "your Telerik points have been updated".

For the reply for my second question,
                           I have tried all these. But I didn't get way to meet my requirement.

And what is the solution for my third question??

Please reply me.... Please help me..

Posted by Community Admin on 02-Aug-2012 00:00

Hello,

To answer your third question you need to go to Administration -> Backend Pages click "OK, Continue" . Navigate to Sitefinity->Design->Templates where you will see the Page Templates page. From the Actions menu choose Permissions and set the required permissions to your custom role. This time you should be able to see the Page Templates in the Design menu. If you want to edit the page templates with your custom role however, you will need to give permissions to each individual template by going to Design->Page Templates and from the Actions menu for each page template choose Permissions. Instead of doing this manualy for each template you can use this code:

void SetPermissionsForAllTempaltes(string roleName, params string[] actionsToGrant)
        
            RoleManager roleManager = RoleManager.GetManager();
            Role role = roleManager.GetRole(roleName);
 
            PageManager pageManager = PageManager.GetManager();
            var allTemplates = pageManager.GetTemplates();
            foreach (var template in allTemplates)
            
                Permission permission = pageManager.GetPermissions().FirstOrDefault(p =>
                    p.ObjectId == template.Id &&
                    p.PrincipalId == role.Id &&
                    p.SetName == SecurityConstants.Sets.PageTemplates.SetName);
 
                if (permission == null)
                
                    permission = pageManager.CreatePermission(
                        SecurityConstants.Sets.PageTemplates.SetName,
                        template.Id,
                        role.Id);
                
 
                if (!template.Permissions.Contains(permission))
                
                    template.Permissions.Add(permission);
                
 
                permission.GrantActions(true, actionsToGrant);
            
            pageManager.SaveChanges();
        

This method will go through all available templates and assing the desired permissions for them. You need to give it the role name and the permissions you want for example:

SetPermissionsForAllTempaltes
                (
                "MyRole", 
                SecurityConstants.Sets.PageTemplates.View,
                SecurityConstants.Sets.PageTemplates.Create,
                SecurityConstants.Sets.PageTemplates.Modify,
                SecurityConstants.Sets.PageTemplates.Delete
                );

On a side note I would like to point out that the built-in Designer role is unique and you won't be able to assigne all it's functionalities to your custom role. For example under Designer role you are able to create Page Templates and edit them right away, bur for your custom role, after creating a template you will need a permission from the Administrator to edit it. 

That being said if you need to add the Designer permissions to your custom role, you can just assign both roles to your user. 
Greetings,
Pavel Benov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 03-Aug-2012 00:00

Hi,

            Thank you very much Pavel Benov..

This thread is closed