How do I load a Sitecore sublayout automatically so that permissions are respected? - permissions

I've created a sublayout (usercontrol) with some simple html. I want to display this sublayout only if the user belongs to a certain role.
If I use the built in sitecore developer center to add the sublayout, I end up with something like
<sc:Sublayout runat="server"
RenderingID="{item guid here}"
Path="/layouts/sublayouts/someusercontrol.ascx"
ID="Sublayout1" placeholder="content"></sc:Sublayout>
Denying read permission for the sublayout used there has no affect (I assume it's getting loaded because the file path is there right? ). If I take the Path out I get nothing regardless of current user role.
I don't want to manually check if the current user is in the right role from the codebehind. What markup do I use to get the sublayout to consider the user's permissions and determine visibility?

I don't think it's possible to control sublayout visibility based on a user role in markup. If you dynamically added this sublayout to a placeholder, you could use conditional rendering ("Personalize" button in 6.5) to accomplish this, hiding the component unless the user is a member of a specific role.

Related

How can I create internal user using my custom module in odoo15?

I don't want to use 'users' menu item and want to manage users from another menu item named 'Merchant' and only a specific user group data will be there and while creating new record I want to set a specific user_group. Is there any approach for that?
You can simply add the menu directly under your module. Get the menu for res.users and put where ever you want. Don't forget to add dependency to base.
While doing that you can add a domain to the menu item and filter according to your needs.
Also put that domain into the context of the menu with giving a default value same as the domain. That is, you need to put the required settings in the context like {default_FIELD_NAME: VALUE}. You need to use the default_ prefix for it to work. That way when creating a new user from your menu the context will get the default value and set accordingly. However, if it is not a readonly field, user may change the value. There are two ways to avoid that:
i. create your own form using the res.users and design it the way you like it with default values.
ii. inherit the view of res.users and change the related field to be readonly if a certain context value is passed. Then you can call the view with context let's say {readonly_group_x: True} and it should work. Also you may need to make sure that force_save="1" is set since it may not save the readonly field.
These are the basic steps of accomplishing what you have described. However, working with res.groups can be challenging depending on what you want to do. You may need to tweak or even end up creating your own view with the desired effect.

TYPO3 permissions: Allow backend users to copy content elements but not to edit them (or: how to provide users a library of content elements to copy)

i’d be thankful for some help (maybe i didn’t find the correct terms for a search on the internet?).
Topic: Permissions / Module “Access”
I’m looking for a way to configure permissions in such a way that some backend user are in the same time:
allowed to see (in the page module) all content elements on a certain page
not allowed to edit/hide/delete them
are allowed to copy them into the clipboard
The idea is to give them a kind of library pre-filled+preconfigured content elements to copy and paste on “their” pages.
As soon as i disable the permission to “edit content” on the page in the module “access”, they don’t have a “copy” item in the context menu of the content element anymore.
Is there a way to achieve the goal?
Allow your editor to use the content element «Insert Records». So you can place the prefilled and pre-configured content elements on a page without edit permission.
Editor can «clone» the content elements on their page without the possibility to edit them.
In frontend there is no difference between the original content element and the «clone».
Your scenario is definitely possible. I've just set up a demo TYPO3 installation where this works fine.
You need to create two backend user groups for access:
one for the read only page
and one for the regular pages
In the access module you assign the read only group and set the access rights for read only page only to "Show page".
Then it should be possible to just copy from that page:
I hope this is helpful for you to reproduce it in your installation.

How to set permissions so a user (Role) can Edit Content but not Change View

I have a user in the Role "Content Manager". The Role "2sxc Designers" exists and the user is not in that role.
My hope or expectation was that they would be able to edit Content but not change the view. Am I missing something? What are the steps needed so that a Content Manager can edit the content but not see/use the the Change View option? I realize I can code it in the View (Razor), but this seems like a common use case, no?
I believe this specific option would require that you use content-type or item permissions. So basically DNN would believe that the user doesn't have edit permissions, then you set the permissions you want on either the content-type (if a user is allowed to edit all BlogItems) or specific items (for example, if registered-users may create, and people who created may edit).
then in your template you would have to enable editing with Edit.Enable(). You'll need to google it a bit, but it's a common use case.

Joomla, assing menu-item to particular user

I am designing a photographers website.
What i need to do is allow every logged in user to view -ONLY- his portfolio and no other.
Since i haven't found any extension that does that in style, i decided to use a general portfolio extension, and create a portfolio for each user.
Then i need to find a way so that when a user logs in, with his username/password, a menu-item will appear that will hold -ONLY- his portfolio.
So my question is, how can i do that???
Assign a single menuitem to a single user.
Thank you.
The only idea I have in mind is to use user groups here. Create the user, create the user group, assign the user to the group and assign that group to the object you want to protect.
If it's just about showing images I have another idea.
I build that user group specific handling into Event Gallery, a Joomla! gallery component: https://extensions.joomla.org/extensions/extension/photos-a-images/galleries/event-gallery/
Doing this make creating different menu items unnecessary. Once the user logs in he can see his content. In addition the content is protected. A simple menu item might not do that trick.

Sensenet: Pagination on Document Library

It is possible to define pagination on document library?
I have a document library with more that 10000 documents... when I open the library occurs an timeout.
Actually SenseNet already does this! They just don't deliver it in the standard list control. If you open up the PRC and navigate to /Root/IMS/BuiltIn/Portal you'll see a list control with paging. The code can be found at /Root/Global/renderers/UserExploreGrid.ascx as User Control portlet. You can copy the code and change it to meet your needs.
Our company prefers to create User Control portlets and use Datatables with calls to the SenseNet OData API using skip and top to deliver pages.
Finally, given that SenseNet Content is stored as a tree structure (in SQL!), you can move the Content after creation so that data is organized hierarchically. A common solution is to take the first letter of the DisplayName and create a sub-folder from that letter, thereby reducing the number of items at a single node.
Here's what the paging looks like:
The short answer is no. Right now there isn't a built in functionality for that.
The long answer is that you can make a pagination yourself. One of the core member of sensenet made a grid where you can use pagination. It won't work with the current free to use releases because they lack the js files she used. But the idea behind it, is using a custom view. Which you can achieve by adding a system folder named Views under a the Document library and adding your custom view there.
You can use this grid for Explore, just follow these steps:
Go to the Explore action page, and switch editor mode on the PRC.
Place a ClientContext portlet (this can find under the Portlets->Application section in the portlet picker dialog) to the Wide column. Set portlet (client context porlet) properties, Apparance to None. It is a technical portlet, which allow get the CurrentContext in javascript. This is a very important element to work with this grid. The Grid use the client context.
Place a UserControlPortlet (In the portlet picker, Portlets->Application section) to the Wide Column.
Set portlet properties:
4.1. Portlet title: <%$ Resources: PortletTitles, Items%>
4.2. User Control path: /Root/Global/renderers/UserExploreGrid.ascx
Checkin Page modification on the PRC.
Enjoy your pageable explore portlet.
Keep in mind that this grid is specifically designed for users, so they will miss actions in the top menu. These must be handwritten. Then I suggest you copy the UserControl ( /Root/Global/renderers/UserExploreGrid.ascx)
and then put the action list on it . You can read more info about action list here: http://wiki.sensenet.com/ActionList
Br,
maros