How to apply access control to parts of my Joomla 2.5 component's preferences? - joomla

I am creating a MVC component in Joomla 2.5. I am using access control to restrict access to different backend views of this component. Each of these views have some option fields in the component's preferences (config.xml).
I know how to apply access control to restrict access to the preferences as a whole, but I am wondering if there is a possibility to apply different access control restrictions to some of the fields within the preferences.

If you're talking about the Preferences you add to your main view using:
JToolBarHelper::preferences('com_mycomponent', $height, $width, $alt, $path, $onClose);
Then no, there is nothing in the checks the access of a given field in com_config's default view (/administrator/components/com_config/views/component/tmpl/default.php)
One possible solution would be to only present the real Preferences button to Super Users or those with equivalent permissions and then create a customised version for all other users that only presents the fields from the form they have permission to use.
Of course this means you'll have to manage those additional meta-permissions yourself.

Related

Changes to Joomla live site

Is it possible to make changes on a Joomla live site,without making it offline or interrupting users?
There is going to be added a new feature, but I wonder if it is possible to do while it's live.
Depends on what type of functionality you are trying to block. If it is something controlled within a module or menu item, you can set access to special and then login to the front as an admin to see.If it is within the PHP, you can wrap it in a conditional checking the user's access level.

Let an editor change custom user settings in EPiServer

I am creating an EPiServer portal that users will log on to and view information specific to their company. A company can have many users. Every user will need specific settings to present correct data to them. These settings are maintained by an editor, not the user him/herself.
I could of course do a admin page that connects to a simple database, but I would like to use EPiServers built in interface for handling users if possible.
Is it possible to extend the "Edit User" interface to allow editing of custom properties?
Maybe also use ASP.net's system for custom properties in SqlMembershipProvider?
Sounds like you should use the SqlProfileProvider, take a look at this post:
http://world.episerver.com/Blogs/Stefan-Forsberg/Dates/2009/5/Adding-a-connected-Company-field-to-an-EPiServer-user--A-love-story/

Joomla User Profile plugin, how to change the post url?

I'm using the user profile plug in for user registration form, but I need to change the url the form get posted to when submitted.
How can I do it?
The user profile plug-in is a core plug-in that extends com_user... it doesn't control the submission of the user registration form.
If you want to modify the user profile process, then the safest way to do it would be to make a copy of the user profile plug-in, rename the relevant sections to make it your own plug-in — you probably want to start with this section on Plugins.
By modifying your own copy you will be able to keep up-to-date with Joomla's security patches because you won't have modified a core file.
If you want to modify the registration process, you would need to override com_user before doing that though I would suggest you check the Joomla! Extension Directory (JED) first. There are a large number of extensions that modify the registration process, offer integration with other systems and extend the user profile already in existence.
Another tack might be to use one of the forms extensions that also handle user registrations — typically they allow you to create all sort of custom form including replacements for the standard user registration form. We've been very happy with a few of them and currently use RSForm Pro! — it's a commercial product but extremely flexible and well supported for the small amount of cost involved.
For the record, the solution was to do a template override /html/com_users/registration/default.php and changing the action to some url specified in the template configuration:
action="<?php echo JFactory::getApplication()->getTemplate(true)->params->get('myFormAction');

How to use multiple themes at the same time

I'm looking for a way to use multiple themes in one XPages application, each theme active in a different section of the application. For instance to support an single .nsf application with both a public facing website (custom theme) and a CMS with a OneUI theme.
You can set which theme is used through the whole application on the XPage Properties tab in Application Properties. It's also possible to change the theme for a user's session with this code:
context.setSessionProperty("xsp.theme", <theme_id>)
But both options set the theme for all pages in the current .nsf, and I'm looking for a way to specify theme X for one part of the application and theme Y for a second part.
Is this possible?
On any page that should use an alternate theme, use the following syntax to apply the property directly to the view root:
<xp:view>
<xp:this.properties>
<xp:parameter name="xsp.theme" value="alternateThemeName" />
</xp:this.properties>
</xp:view>
I tried all of the above, but none of them worked for me. But I found a solution:
Paste this into the view's beforeRenderResponse event:
context.setSessionProperty("xsp.theme", "yourAlternateThemeName")
There is one issue: once you have used this way you have to use it always and on every page as this sets a session property which is stored as long as you are logged in.
Just talked with colleague Tony Mcguckin.
You can change the theme per page. Under all properties of the XPage select data-properties and create a new property with name "xsp.theme" and value "yourThemeName".
While I like the idea of having page-specific themes, based on the specific use case you're describing, the "right" way to do this is to have two separate XPage applications bound to the same back end data store. Not only does this make it simple to specify a different theme for each, it also simplifies the ACL (assuming you'll have different people accessing the public site vs. the CMS), makes it easier to tune performance by having different settings per application, and even without having application-specific settings, should improve performance slightly just because of Java class loader behavior: each NSF acts as a distinct ClassLoader, and each XPage or Custom Control in your NSF results in the storage of a separate class file. So, in theory, if the features of your public site require you to create 5 XPages and the CMS features span 10 XPages, simply splitting these into two separate apps makes it easier for the class loader to retrieve the class for any page a user loads, because it doesn't have to ignore the classes it will never need for that user just to find the one class it does need at the time. So I'm still tempted to find a way to get page-specific themes working just for the "cool" factor of it, but for this specific purpose, I'd recommend using two different applications entirely, with a different theme assigned to each.
I dont know that much about themes but cant you check in your theme (with some ssjs) at which viewroot ( by id? ) you are and according to that include the correct styles , css and other resources?

Joomla 1.7:- How do i do this please (kinda facebook)

Joomla comes out standard with registered user, and public user
If I add a third (registered) User that allows the third user to a) create a single separate page in Joomla that the user can input pictures (like you do on face book). b) Access all pages as the standard registered user does.
How do I go about that in Joomla 1.7, add a third (registered) User and give it level 2 accesses?
Then how I create a single page for each user. Somehow I need a reference to each user’s page and show that in a list and control the list search parameters. And i need the page viewable when selected and in the page info needs to be received by the third user. I’m not creating face book but I need that sort of techno somehow.
Can someone point me to what I need to look at, editorials, videos, etc. I know I need to lean PHP better.
Could I make a foulder for each registered user to hold photo's and name the folder acourding to the user's name or email address.
I would recommend to go with a component that offers the functionality that you need. You will find it easier to control the user rights there as they are standard settings available. This is more convenient than building everything from scratch.
Some well known components are:
Community Builder (main component free)
JomSocial (commercial component)
There are more components and plugins available, you may also want to search the Joomla Extensions Directory (JED) for something suitable (http://extensions.joomla.org/extensions/social-web)

Resources