Is it possible to attach permissions to content parts in Orchard CMS? - c#

Let's say I have a content type called Seminar. The Seminar type has three parts welded to it- Room, Schedule, Subject.
When a user edits a Seminar, they will be shown the editor templates for those three parts.
What I would like to do is add permissions to each of the parts so that we can restrict which users can edit which parts. For example, someone with a Scheduler role will be able to view/edit the schedule part, but not the others.
Is this possible out of the box? If so then how can I do this?
If I can't do this out of the box then is anyone aware of a module that I can use to achieve this?
And finally- if there is nothing available that can do this, can anyone point me in the right direction to implement this myself?

In code, you can check any permissions you want, including your own custom permissions, from the part's driver, and prevent it from displaying anything. Even if it's not your part, you can intercept shapes and prevent them from being displayed, from a shape table provider. But there is no module that I know of that lets you choose permissions for parts without writing code.

Related

c# openfiledialog to select multiple files with same order as user selects

In my c# windows application, I like to get multiple files with a same order as user select the file in openfiledialog window. I'm getting all the selected file but its order is not correct. Anyone help me to solve this problem.
If you look at the documentation for the underlying control's interface OPENFILENAME, you'll see this comment:
If the user selects more than one file, the lpstrFile buffer returns the path to the current directory followed by the file names of the selected files.
And, other than some comments on the separator characters used for different scenarios, what to do if there's not enough buffer, and some details on legacy 8.3 support, that's it. In other words, the OpenFileDialog doesn't offer any mechanism to bubble up the sort information as the underlying Windows Common Dialog Box doesn't offer anyway to get this information out via a standard interface.
If you must preserve it, you'll need to create your own Form or Dialog to track the selection in order, and honestly you'll probably be better off providing an slightly different UI that allows the user to reorder files after they've selected them, similar to how one can reorder lists on some mobile devices.

How can I copy HTML textbox values from one domain to another domain's textboxes?

I'm trying to help save time at work with for a lot of tedious copy/paste tasks we have.
So, we have a propitiatory CRM (with proper HTML ID's, etc for accessing elements) and I'd like to copy those vales from the CRM to textboxes on other web pages (outside of the CRM, so sites like Twitter, Facebook, Google, etc)
I'm aware browsers limit this for security and I'm open to anything, it can be a C#/C++ application, Adobe AIR, etc. We only use Firefox at work so even an extension would work. (We do have GreaseMonkey installed so if that's usable too, sweet).
So, any ideas on how to copy values from one web page to another? Ideally, I'm looking to click a button and have it auto-populate fields. If that button has to launch the web pages that need to be copied over to, that's fine.
Example: Copy customers Username from our CRM, paste it in Facebook's Username field when creating a new account.
UPDATE: To answer a user below, the HTML elements on each domain have specific HTML ID's. The data won't need to be manipulated or cleaned up, just a simple copy from ourCRM.com to facebook.com / twitter.com
Ruby Mechanize is a good bet for scraping the data. Then you can store it and post it however you please.
First, I'd suggest that you more clearly define exactly what it is you're looking to do. I read this as you're trying to take some unstructured data from Point A and copy it to Point B. Do the names of these fields remain constant every time you do the operation? Do you need to simply pull any textbox elements from the page and copy them all over? Do some sort of filtering of this data before writing it over?
Once you've got a clear idea of the requirements, if you go the C# route, I'd use something like SimpleBrowser. Judging by the example on their Github page, you could give it the URL of the page you're looking to copy, then name each of the fields you're looking to obtain the value of, perhaps store these in an IDictionary, then open a new URL and copy those values back into the page (and submit the form).
Alternatively, if you don't know the names of the fields, perhaps there's a provided function in that or a similar project that will allow you to simply enumerate all the text fields on the page and retrieve the values for all of them. Then you'd simply apply some logic of your own to filter those options down to whatever is on the destination form.
SO we thought of an easier way to do this (in case anyone else runs into this issue).
1) From our CRM, we added a "Sign up for Facebook" button
2) The button opens a new window with GET variables in the URL
3) Use a greasemonkey script to read those GET variables and fill in textbox values
4) SUCCESS!
Simple, took about 10 minutes to get working. Thanks for you suggestions.

Custom PropertyGridEditor etc. for web part edit zone?

I want to change the appearance of the default editor parts, and am a little unsure of how to go about doing this, as there seems to be a surprising lack of documentation on the subject.
I've been able to create a custom declarative catalog with some trial and error and overriding the RenderCatalogPart method, and now wish to do something similar with my AppearanceEditor and PropertyGridEditor. I've tried just changing the style of the editor parts using CSS, but they are already arranged into tables which are impossible to get rid of. It's not even possible to just take the class as is, because the classes are sealed. So I'm basically stuck with having to write my own from scratch, I guess the questions are as follows:
1) How do I go about getting the information on the controls I need to render?
2) According to the documentation, I need to override the ApplyChagnes and SyncChanges methods - but I can't find any information on what I actually need to put in these methods.
3) On a similar note, is it possible to change the layout of the EditorPart itself, so that the AppearanceEditor, BehaviourEditor etc. are displayed side-by-side instead of on top of eachother?
4) Is there any way to have the page catalog displayed somewhere on the page, even in browse mode? I'd quite like to use it as a 'minimised' area, where users can send web parts they don't want immediately. At the moment they go back into the page catalog and users tend to just add a new part instead. I know that I can have multiple catalog zones on the page, which is great, but it only shows up in catalog mode.
Any help would be very much appreciated.
I didn't get any replies here, but I was able to figure out a way to do some of these.
In the end I decided to use reflection to get each public property on the web part that was WebBrowsable, and figure out what sort of control to display from the type.
The ApplyChanges() and SyncChanges() methods essentially just persist the changes from the page to the personalization blob and vice-versa. It's a matter of rendering some controls on the page, and mapping the values to the properties of the web part in these methods.
I don't think this is possible without writing your own.
Haven't been able to do this, but I don't imagine that it's possible sadly.

Different asp:menu on a user basis

I have a oracle database which stores menu and user data, for a local Intranet.
The data includes which usesr have access to which pages.
Originally I created a class which extened the StaticSiteMapProvider class, however when this went in to the testing environment, i found that this was cached for the whole site (and not on a user basis). After reading up on line on various forums, it was suggested that I should inherit from SiteMapProvider as this would enable me to have a seperated instance of thet SiteMapProvider and ASP:MENU item on a user basis, however this still hasn't solved the problem.
Currently I have a user control, which conrains the asp:menu, and uses my custom site map provider as its data source.
Could anyone suggest how I can display the menu on a user basis, driven from database authorisation?
Also the whole menu should still appear to all users, it only after thy click on a menu node that they will find out whether they have access to that page/node.
Thanks
You can make use of Roles on the SiteMap to define what menu will appear.
There are two things here. If you have static collection of nodes and then you want to show/hide them based on user accessibility then you should override IsAccessibleToUser
method to tell if the given node if applicable for the current user (accessible from given HttpContext).
In case, your nodes collection/hierarchy changes per user basis then try overriding BuildSiteMap to load different nodes for current user. However, I am a bit doubtful if StaticSiteMapProvider is the correct base class in this case. Probably you need to override from SiteMapProvider.

Allow user to customize page sections

Is it possible to allow a user to customize sections of our website to match their look and feel? For example, to modify logos and CSS, possibly pointing back to their site for the actual content. Ideally I would also like a third-party (ASP.NET) tool to manage this, rather than coding a hack myself.
Edited: I want a solution where a customer can just use a menu to modify the attributes they want, so that there is no need for me to interact with the customer at all.
What you want is a CMS (Content Management System), there are lots out there. Just find one that suits you.
I hear Sitefinity is good.

Categories

Resources