留言板

PortalPreferences: number at the end

Jose Pablo Araya,修改在8 年前。

PortalPreferences: number at the end

New Member 帖子: 2 加入日期: 15-9-14 最近的帖子
Hi,

I have a doubt: what is the number at the end of the portal preferences that are stored in the portalPreferences table? How can I know this number?

These are two preferences that are saved there:

	<preference>
		<name>ldap.security.principal.70922</name>
		<value>dir\jose.p.araya.camacho</value>
	</preference>
	<preference>
		<name>ldap.server.name.70922</name>
		<value>TEST</value>
	</preference>


I need to know this number in order to use the next code:
        final String providerURL = PrefsPropsUtil.getString(companyId, "ldap.base.provider.url.70922");
        final String principal = PrefsPropsUtil.getString(companyId, "ldap.security.principal.70922");
        final String credentials = PrefsPropsUtil.getString(companyId, "ldap.security.credentials.70922");
        final String baseDN = PrefsPropsUtil.getString(companyId, "ldap.base.dn.70922");


Thanks guys!
thumbnail
Shinn Lok,修改在8 年前。

RE: PortalPreferences: number at the end (答复)

Junior Member 帖子: 89 加入日期: 11-1-14 最近的帖子
The number you are looking at is the LDAP Server ID. You can grab the list of server ids using:

PrefsPropsUtil.getString(company.getCompanyId(), "ldap.server.ids")


If you want the server that the user came from you can use:

user.getLdapServerId()
Jose Pablo Araya,修改在8 年前。

RE: PortalPreferences: number at the end

New Member 帖子: 2 加入日期: 15-9-14 最近的帖子
Thanks for the help guys, it was very useful.

Regards!
thumbnail
Punam Shah,修改在8 年前。

RE: PortalPreferences: number at the end

Regular Member 帖子: 117 加入日期: 12-1-20 最近的帖子
You need to convert liferay preference object to javax.portlets.preference. easier way to access all the preferences.

After then you will get all the stored preferences keys by invoking "getNames()". iterate each enumerate and apply if condition name.startsWith().....

HTH!!!