フォーラム

ホーム » Liferay Portal » English » 2. Using Liferay » General

構造的に表示 平面上に表示 ツリー上に表示
スレッド [ 前へ | 次へ ]
toggle
Vahid M
Activate deactivate users from database
2011/11/08 1:05
答え

Vahid M

ランク: Junior Member

投稿: 26

参加年月日: 2008/03/27

最近の投稿

Hi All,

I have a question regarding activation and deactivation of users in Liferay. I'm using Liferay version 4.4.2. I want to disable a user by just updating the "active_" field in "User_" table. I thought this is sufficient for preventing a user from logging in. Of course, I know that it's possible to disable a user from the UI but I don't want to use the UI.

My problem is, when I disable a user by updating the "active_" to 0 (zero) (which indicates a disabled user), then, when the same user tries to log in, the system automatically enables it again? I cannot understand why this is happening? On the other hand, if I disable a user through UI everything is perfect and that user won't be able to log in again. There should be something that I'm missing. Something more should be done in addition to just changing a field from 1 to 0.

Could anyone please shed some light over this issue?


Thanks a lot :-)
Ravi Kumar Gupta
RE: Activate deactivate users from database
2011/11/08 1:10
答え

Ravi Kumar Gupta

ランク: Liferay Legend

投稿: 1142

参加年月日: 2009/06/23

最近の投稿

Have a look at the source of LR4.4.2 and see how the deactivation process is done. That should help.
Vahid M
RE: Activate deactivate users from database
2012/07/22 10:31
答え

Vahid M

ランク: Junior Member

投稿: 26

参加年月日: 2008/03/27

最近の投稿

This issue is somehow related to database cache I suppose. I performed a test and it’s working. I updated active_ field from 0 to 1, which means I enabled the user, by updating the database table. Then I immediately tried to login and it was a failure. Next time I did the same except after the update I waited for couple of minutes. By waiting, I think the cache got expired and the state of the user was checked against the data from the database not data from cache. This is my understanding. It might have other reasons.
David H Nebinger
RE: Activate deactivate users from database
2012/07/22 11:26
答え

David H Nebinger

ランク: Liferay Legend

投稿: 6439

参加年月日: 2006/09/01

最近の投稿

You should never update the database directly. Updates should only be done using the Liferay API.

Liferay uses lucene indices, especially for users. The only way to ensure lucene is updated is to use the Liferay API.

Seriously, this comes up over and over again. It doesn't matter how many times we tell people not to modify the database, they keep insisting on trying and then wonder why their database updates are not reflected.
Hitoshi Ozawa
RE: Activate deactivate users from database
2012/07/22 14:23
答え

Hitoshi Ozawa

ランク: Liferay Legend

投稿: 7990

参加年月日: 2010/03/23

最近の投稿

Yes, liferay uses data from a cache instead of directly from the database. Cache is used to increase performance as well as to share content across a cluster.

Waiting cache to timeout is one alternative, but it's possible to force cache to clear from Control Panel -> Server Administration -> Clear Cache or by restarting liferay.

David talked about indexing but cache is actually not related to indexing but liferay api ensures indexes are updated as well.