Foren

How to disable My Account

Boris Niyazov, geändert vor 16 Jahren.

How to disable My Account

Junior Member Beiträge: 27 Beitrittsdatum: 14.04.08 Neueste Beiträge
Hello there,

We are evaluating Liferay to use as an enterprise portal at the Columbia Law School. We're able to integrate it with our LDAP and would want to disable field modifications on My Account page, since the info is synchronized with LDAP I was trying to search the message board for that but without any success. Any help will be appreciated. We are using Liferay version 4.4.2

Boris
thumbnail
Victor Zorin, geändert vor 16 Jahren.

RE: How to disable My Account

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
If you need to secure your LDAP store:
- Use one-way synchronisation with LDAP
- Disable access to MyAccount for non-admin users. The easiest way is by modifying your theme templates, 5 minute job.
Leandro Del Sole da Silva, geändert vor 16 Jahren.

RE: How to disable My Account

Junior Member Beiträge: 98 Beitrittsdatum: 07.04.08 Neueste Beiträge
Victor Zorin, could you specify how to disable it?
What I must change for disable that?

In my case, I want to disable My places for the normal users...

Thanks
thumbnail
Victor Zorin, geändert vor 16 Jahren.

RE: How to disable My Account

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
Hi Leandro

Have a look at the look-and-feel theme that you are using.
It would usually have the file called 'init_custom.vm' that is located on '.../html/themes/{theme-name}/templates/' path, say for brochure it is 'ROOT.war\html\themes\brochure\templates\'.

To disable MyAccount, open this 'init_custom.vm' file for editing, and add the following line:
#set($show_my_account=false)


This would disable showing of MyAccount option for everyone.
The default behavior for show_my_account variable is true for signed-in and false for not-signed-in.
If you need to make it current-URL or user-role dependent, some extra scripting would be required.

You do not have to restart Liferay, for the changes to take place, just hit the 'refresh' button on your browser.

Regards
Victor
Leandro Del Sole da Silva, geändert vor 16 Jahren.

RE: How to disable My Account

Junior Member Beiträge: 98 Beitrittsdatum: 07.04.08 Neueste Beiträge
Thank you Victor ! emoticon
Suresh Amala, geändert vor 16 Jahren.

RE: How to disable My Account

New Member Beiträge: 5 Beitrittsdatum: 01.04.08 Neueste Beiträge
Hello Victor

could you suggest the way to "Disable access to MyAccount for non-admin users".
thumbnail
Artur Linhart, geändert vor 16 Jahren.

RE: How to disable My Account

Expert Beiträge: 459 Beitrittsdatum: 13.09.07 Neueste Beiträge
Hello,

To know which variables are possible to use, go and look into the files

webapps\ROOT\html\themes\_unstyled\templates\init.vm

and

VelocityVariables.java (You need to download the source codes for it)

The *.vm are the files written in velocity, so You need to know the velocity syntax to get over it.

So, for example, You can modify the dock.vm from the original one:

		#if ($show_my_account)
			<li class="my-account">
				<a href="$my_account_url">$my_account_text</a>
			</li>
		#end


to the following one:

          #if ($permissionChecker.isOmniadmin())
		#if ($show_my_account)
			<li class="my-account">
				<a href="$my_account_url">$my_account_text</a>
			</li>
		#end
          #end


- You can use for example various methods from permission checker:


public interface PermissionChecker {

	public long getUserId();

	public boolean hasPermission(
		long groupId, String name, long primKey, String actionId);

	public boolean hasPermission(
		long groupId, String name, String primKey, String actionId);

	public boolean hasUserPermission(
		long groupId, String name, String primKey, String actionId,
		boolean checkAdmin);

	public boolean isOmniadmin();

	public boolean isCompanyAdmin(long companyId);

	public boolean isCommunityAdmin(long groupId);

	public boolean isCommunityOwner(long groupId);

}
thumbnail
Jerry Niu, geändert vor 15 Jahren.

RE: How to disable My Account

Expert Beiträge: 451 Beitrittsdatum: 21.06.06 Neueste Beiträge
The suggestions to remove it from the theme via hard coding and via dynamic elements does prevent a user from "clicking" something.

If they have the URL, they can still get to the page.

My suggestion is to add the LDAP sync on a daily basis to update Liferay with the latest LDAP information about a user.

Secondly, I would programmatically add the role check to the my accounts page and prevent them from changing the data in the first place. You can do this in the code by extending the my accounts portlet. You can also prevent "role" from accessing the portlet.
Boris Niyazov, geändert vor 15 Jahren.

RE: How to disable My Account

Junior Member Beiträge: 27 Beitrittsdatum: 14.04.08 Neueste Beiträge
Yes, Jerry, you're right - hiding My Account from the drop down does not generally prevent users getting to it. For example, they can get their via directory portlet and modify the content. I thought that My Account portlet can be configured to make it only viewable and not editable by ordinary users (by the means of assigning access modes for different roles) but I can't see that option, at least in the version 4.4.2 that I installed, and I am not sure why it wasn't done. So, I guess we'll have to follow your suggestion of extending the portlet code.

Your suggestion of daily syncing with LDAP does not look very attractive to us though - we prefer real time updates, and consider triggering liferay data updates when LDAP account is updated/removed. Does liferay have any utility out of the box that would do the background user account update or it has to be developed? Or maybe someone already done that.

Thanks
thumbnail
Artur Linhart, geändert vor 15 Jahren.

RE: How to disable My Account

Expert Beiträge: 459 Beitrittsdatum: 13.09.07 Neueste Beiträge
Hello,

if there will be no other chance, You can modify the JSP in such a way the user will not be able to modify some specified fields from the "My Account" portlet fields... This should be not very time-consuming operation. You can find all the actions related to the "My Account" in struts-config.xml if searching for string "my_account". There You can find the mapping to the java actions and find the related JSPs in tiles-def.xml (use the forward name from the struts-config.xml file). If You have the JSP You can modify it to obtain the requested functionality. The JSP can be used in more portlets/actions, so there should be performed the modifications which will not cause the problems in the various usage contexts - but I could imagine, this will be possible to implement in Your case, because You want the user is unable to edit his fields independently on the context where the JSP is shown.

It's not the solution, only pointer to the way :-)

with regards, Archie
thumbnail
Victor Zorin, geändert vor 15 Jahren.

RE: How to disable My Account

Liferay Legend Beiträge: 1228 Beitrittsdatum: 14.04.08 Neueste Beiträge
Boris Niyazov:
hiding My Account from the drop down does not generally prevent users getting to it. For example, they can get their via directory portlet and modify the content. I thought that My Account portlet can be configured to make it only viewable and not editable by ordinary users ...

This is true, but rather than modifying JSP it is easier to disable MyAccount portlet completely by commenting it out from liferay-portlet.xml file. This way it is no longer going be available to anyone. Administrator would still able to apply necessary modifications to user details using Admin tools.
Friedrich Heinzinger, geändert vor 13 Jahren.

RE: How to disable My Account

New Member Beitrag: 1 Beitrittsdatum: 06.08.10 Neueste Beiträge
Hi,

I know this is an old thread but it describes exactly my problem.

Using LR 5.2.3

When I disable the "My Account" the usual way, that is using <include>false</include> in liferay-portlet.xml, it shows no effect at all. This works with other portlets, for example with "My Pages".
When I disable the whole "My Account"-portlet tag, it gets not accessible: when accessed it displays an error something like "...no-permission.." (The link in the control panel and in the dock to "My Account" are still there).

So either way: I have do remove the menu item from the theme. Is this correct?
And I would also have to remove the menu-item from the control panel... ?!?, since I want to have it removed completely.

I managed to remove the menu-item from my own theme, but not from the "classic"-theme. I tried modifying "init_custom.vm" in "classic" and "_unstyled" (only because "classic" didn't work) without success. Is there something I missed?

I couldn't find any hint in the controlpanel-theme for these menu-items (on the left). Where would I have to remove the "My Account"-link?

Thanks for any inputs.
F.
thumbnail
Bryan Cheung, geändert vor 15 Jahren.

RE: How to disable My Account

Expert Beiträge: 373 Beitrittsdatum: 27.08.04 Neueste Beiträge
Boris Niyazov:
Hello there,

We are evaluating Liferay to use as an enterprise portal at the Columbia Law School. We're able to integrate it with our LDAP and would want to disable field modifications on My Account page, since the info is synchronized with LDAP I was trying to search the message board for that but without any success. Any help will be appreciated. We are using Liferay version 4.4.2

Boris


Hey Boris,

I almost attended CLS had I not been sidetracked by this whole open source software thing. emoticon I hope you guys decide to use Liferay - what are the decision factors for you?