Show menu items when authenticated in Orchard - orchardcms

On the main menu I have 5 items for an Orchard site. Some of those menu items I only want to be visible after a user has logged in.
Any suggestions on how to do that?

The easiest way is to have two menus, one on the non authenticated layer and one on the authenticated layer, and have the authenticated items only on the menu being displayed on the authenticated layer. It introduces some replication but yeah, easy.

You could enable Content Item Permissions and make your MenuItem Content Types Securable in their Content Definition. That way you can select exactly which roles are able to see each link.
Enable the Content Item Permissions feature
Check Securable and Securable Content Items in the Content Defintion of the Content Type you want to secure
Attach the Content Permissions Part to the Content Type you want to secure
Now you can set global permissions for the Content Type in the Content Permissions Part settings or override them on individual Content Items by checking or unchecking the appropriate boxes for every Role.

Related

User in SharePoint Group get access is required message

I have a SharePoint Site where I created a List and I want to give read and add access to this list only to a limited group of people.
First I created in the SP site the List "ListX"
In the ListX settings I went to list permissions and I stopped inheriting permissions from the site and I created unique permissions
On the site advanced permission settings I created a new permission level "Add and View Only" where I selected the following options:
On the list permissions section
(a) Add Items - Add items to lists and add documents to document libraries
(b) View Items - View items in lists and documents in document libraries
The moment I selected those two options the following options have been automatically selected for me on the site permissions section:
(a) View Pages - View pages in a Web site
(b) Open - Allows users to open a Web site, list, or folder in order to access items inside that container
Then on the site permission I created a SharePoint group "ListX Users" and I gave the permission level "Add and View Only"
Then I added several users in the SP group "ListX Users"
Then I granted permissions on the ListX permissions to the "ListX Users" SP group
However the user gets the message "Sorry you don't have access" when they try to go to the top level of the site so that they can click on the ListX link and they are prompted to request access.
Any idea why that happens and how to give such Add and View access to the ListX only? Thanks
Best (and easiest) imo is to work down. Give them permissions on site level and break inheritance on each library that shouldn't be visible for everyone.
That way the navigation is the easiest and for maintenance has the easiest overview.
I partially solved my issue by adding two more options in the List permissions permission levels of "Add and View Only". See below.
Open Items - View the source of documents with server-side file handlers
View Application Pages - View forms, views, and application pages. Enumerate lists
However in this case the user need to have a direct link to the list and cannot navigate via the site.

Liferay 6.2 portlet custom roles

I have created a custom Regular Role and I have inserted it inside portlet.xml of so-portlet(security-role-ref element) and I have also mapped it with the respective role in liferay-portlet.xml.
However, when a user owns only this custom Regular Role, an error message is displayed "You do not have the roles required to access this portlet".
It is also strange that this happens only in user's personal site, on any other site user is able to view the specific portlet.
Does anyone has any idea about this?
Since you have a Custom Regular Role for your App, you should edit the default Role Permissions
log as an admin
Go to Control Panel, Roles,
Find your Role, and from the Actions menu on the right side, pick Define Permissions
From the left menu, find your application
Edit your permissions. Make sure to have the 'View' action granted for your Role. You can additionally, allow it for all sites (default), or you can just select the 'User Personal Site'
Now, if you want to make an exception for a specific portlet instance (that's what I meant in my question, in the comments) you can:
Log as Admin
Navigate to the specific Page where your portlet instance is added.
Enable Edit Controls, and edit your portlet (mini menu on the upper right side, with the wrench icon)
Pick permissions and have your Role allowed to view the portlet
The Personal Site is a Private Site if I remember well, so i think your user is not a site member, necessary condition to view the private pages.

Can I Restrict "Add Items" Permission

Hi
I am been looking at the different permissions and I am wondering is it possible to restrict what a person can add?
I just see "add Item" and this seems to allow a user to add anything. Weere I want some users to be only able to add a "page" were other users can add a "page" and a "category"
Just a thought. If we go to the root site -> site settings -> Site permissions. you will be listed with site permissions of the site. Clicking on settings of the list, you get Permission levels, where you can add a new permission level.
In your case, there can be 2 permission levels created - one which allows adding items to lists and other which allows adding pages. These permissions can be used while creating users or groups to assign permissions.
Hope this helps.
Add an event receiver to the list, and if they try to add something of the wrong content type, cancel the add in the event receiver.

How to make webpart properties customizable only by an Administrator

I am developing a sharepoint 2010 visual webpart that will show some sort of ajax content.
I have a property on the webpart for the refresh rate, but I want this property to be set only by an Administrator (or any specific group).
What is the best way to achieve this?
Thank you.
In our organization, everyone by default is granted "Read" permission to our SharePoint sites through an "All Employees" Active Directory group. This allows users to browse the pages, but not edit them; and if you can't edit a page, you can't edit any web parts on the page.
Those who should have elevated privileges are added to other AD groups (you could use SharePoint groups too), and those groups are granted appropriate permissions.
You could create a custom Toolpart. Take a look at this example for a tutorial on how to create one.
Overall, your general steps will be:
Create your custom Toolpart class inheriting from Microsoft.SharePoint.WebPartPages.ToolPart
In your custom Toolpart, override CreateChildControls, write the code to display your textbox as long as the current user has permission (based on whatever rules you choose, ex: SharePoint group).
In your webpart, override GetToolParts and add your custom ToolPart so that it shows up in the right hand side

Adding items to anonymous lists via code

We have a custom list inside a moss publishing site that an asp.net form is submitting information to.
We seem unable to submit the form when accessing the site anonymously, though we have turned off viewformspageslockdown, have enabled anonymous access on the site and allowed add anon on the list itself.
We can navigate to the list and add a new item from the moss gui but from our asp.net page, when we submit, it redirects to the login page.
Anonymous Means Read-Only, If you want to enable the user to add items while in Anonymous you need to use the SPSecurity.RunWithElevatedPrivileges in the ASP.NET Page code.
You will need to check the security on the Custom List to ensure that the anonymous users can modify the list items. You should be able to check the effective security in site administration.

Resources