Joomla : How to set access permission from a custom component? - joomla

Currently I am creating a custom component for Joomla 2.5.
In this component I need to create users that are assigned to particular user group, say 'Test'.
If any user assigned to 'Test' is loggined from the back-end (i.e. admin login), then I need to hide all admin menus and redirect the user to a particular page inside my component.
In other words that user is restricted from other admin areas.
The problem is that I have to perform all of these actions from my custom component. Is there any way to achieve this? Any help will be much appreciated.
Thanks in advance.

You can use this Joomla - ACL and download source code from bottom of the page.

Related

Strapi override admin panel controller

I am interested in overriding the strapi admin panel webhook controller to give it some more functionality. e.g. Allowing customization on a per model level instead of every entity create/update/delete calling the webhook. It seems like you cant override controllers by just adding them to the admin folder like you can other parts of the admin frontend. Im looking for advice on how to proceed with this or if creating a custom plugin is my only option at this point.
Thanks, Jordy
if you want to customize the admin panel, you will have to follow this documentation - https://strapi.io/documentation/3.0.0-beta.x/concepts/customization.html
It's the same for the admin part of a plugin.

Joomla 2.5: assign user to usergroup from front-end

I have statically defined user groups with statically defined access rights.
And I want to be able to change the user group for given user from the front-end using some module.
Reason: users can register by themselves, and automatically go to group "registered". After some time they can be promoted and moved to group "member". But I don't want to do this from back-end, bcs e.g. promotion can be done by any another already member. So I need this in front-end.
I haven't found any mention about this in Google. Maybe this is just something obvious? Are there any module/plugin perfoming such task?
The Joomla core components don't allow this. But you can search on http://extensions.joomla.org/extensions/clients-a-communities/user-management if there is something that fits your needs.
Maybe this one: http://extensions.joomla.org/extensions/clients-a-communities/user-management/13753
You could make a module with a button and have the button use JUserHelper::addUserToGroup.

Joomla ACL: Only allow access to custom component in the backend?

I'm building a component for the backend. I don't want the users who will access it to access ANYTHING else in the backend except for this component.
I tried following these two instructions:
http://www.aclmanager.net/blog/general/31-how-to-add-basic-acl-support-to-your-extension
http://docs.joomla.org/Developing_a_Model-View-Controller_%28MVC%29_Component_for_Joomla!1.6_-_Part_14#Describing_the_ACL
I made a new User Group with a parent of public and allow admin login (which would lock them out of everything) and then tried adding the ACL code from those links above with permissions to create and edit but I just get a blank screen (not even a logout link). The "Debug Permissions Report" showed the correct permissions but nothing's showing up.
Any ideas? My next step is to manually go through every component and not allow access to that new User Group but it seems like there's an easier way.
Thanks!
In Joomla! 2.5 we regularly create "Content" only backend users that have access only to the 'com_content' component.
Going back through our steps the only thing you haven't specified is adding the new user group to a View Access Level. If you're using the standard sample content installed when setting up a Joomla! website you can add your new user group to the "Special" view access (although any will do).
If a new group has 'admin login' privileges it can login but without a View Access level it can't see anything.. it's a subtle difference but it's the way Joomla! works.

display both register and login pages custom component in joomla

I'm building up a custom component, which should only be accessible to logged in users. I'm thinking about checking JFactory::getUser()->guest and if is set, redirect them to a custom page.
Now i prefer this page to contain both register and login options, but joomla itself does not seem to have this feature. Do i have to make this functionality to my custom component, or there is an another solution?
You should really use the built in ACL to control user access instead of trying to code it in yourself. That's kind of the whole point of having the ACL to begin with. Here's the tutorial for how the ACL works in the admin and front end of a site -
http://docs.joomla.org/ACL_Tutorial_for_Joomla_1.6
Here is the tutorial for adding ACL to a component -
http://docs.joomla.org/Developing_a_Model-View-Controller_(MVC)_Component_for_Joomla!1.7_-_Part_14
I think you will be much better served using the ACL system as it allows you a lot more flexibility - like adding additional user groups and permissions later without having to touch the code.
Once you have this set up, making a custom register or login page is as easy as a template override of the default com_user login view. You would need to combine these files -
For the login part of the page:
JOOMLA/components/com_users/views/login/tmpl/default.php
For the registration part of the page:
JOOMLA/components/com_users/views/registration/tmpl.default.php
Then put the new and improved file here:
JOOMLA/templates/YOUR TEMPLATE/html/com_users/login/default.php
That would give you ACL controlled access to your component as well as a custom login/registration page without having to muck around with any unnecessary extensions.
Joomla!'s default login module/page only provide a link to a registration page.
A quick search of the JED shows about 200 login extensions, it's possible one of them does what you want.
However, if you want it integrated with the access to your component you will have to code it yourself. The normal process is that if a user tries to access an asset view the view.html.php (or similar) will check their permissions and depending on the component post an JError message and possibly redirect them to the system login.
eg. com_content
// Check the view access to the article (the model has already computed the values).
if ($item->params->get('access-view') != true && (($item->params->get('show_noauth') != true && $user->get('guest') ))) {
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
return;
}

show specific content for each registered user in joomla 1.6

I am looking for a module/extension, or something that can help me to
make a page/item that only one specific user registered can see.
I would like also create a space dedicated to this user, where i can publish there pages and aticles.
Maybe using php and the variable that contains the username and an iframe, but I dont know how to doit.
Thank for the help
GMAccess is a Joomla! component that makes managing groups and access permissions easy, you will be able to create a special group and add your user (via Joomla's user management) to it and manage which pages can be viewed by that group.

Resources