Laxman
Laxman

Reputation: 81

How to deactivate a liferay user for particular organization?

I have a requirement to deactivate a user for a particular organization.In liferay we deactivate the user directly by control panel under users tool.if i deactivate,The user will deactivate in portal level so it is applicable to all organizations not to particular organization.so can i do manual code for this or is there any alternative by default?

Upvotes: 2

Views: 1987

Answers (2)

Runcorn
Runcorn

Reputation: 5226

OK you could do this in code level ,

User singleUser=UserLocalServiceUtil.getUser(userId)
singleUser.setStatus(WorkflowConstants.STATUS_DENIED);
UserLocalServiceUtil.updateUser(singleUser);

So basically setting User Status to either WorkflowConstants.STATUS_DENIED, WorkflowConstants.STATUS_EXPIRED or WorkflowConstants.STATUS_INACTIVE will do the work of deactivating particular User.

But you need to research on the aftermath effect of these status field.

Upvotes: 0

Olaf Kock
Olaf Kock

Reputation: 48057

User Management in Liferay is global - to the whole portal. You authenticate to the portal, thus a deactivated user can't be authenticated to the portal.

You can make users members of Organizations or site - and this membership (or other organization- or site-level roles) can be used to provide them with permissions.

If you want them to be able to sign in, don't deactivate them. If you don't want them to access a certain organization, make the content of that organization available to members only - and exclude the user from the members of that organization.

Upvotes: 1

Related Questions