本文整理汇总了Java中com.liferay.portal.model.User类的典型用法代码示例。如果您正苦于以下问题:Java User类的具体用法?Java User怎么用?Java User使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
User类属于com.liferay.portal.model包,在下文中一共展示了User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: areThereTriesNotFromEditors
import com.liferay.portal.model.User; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public boolean areThereTriesNotFromEditors(LearningActivity activity) throws Exception
{
boolean resp = false;
List<User> users = getUsersByLearningActivity(activity.getActId());
for(User usu:users){
PermissionChecker permissionChecker = PermissionCheckerFactoryUtil.create(usu);
if(!(permissionChecker.hasPermission(activity.getGroupId(),"com.liferay.lms.model",activity.getGroupId(),"UPDATE_ACTIVE")||
permissionChecker.hasPermission(activity.getGroupId(),LearningActivity.class.getName(),activity.getActId(),ActionKeys.UPDATE)||
permissionChecker.hasOwnerPermission(activity.getCompanyId(),LearningActivity.class.getName(),activity.getActId(),activity.getUserId(),ActionKeys.UPDATE))){
resp = true;
break;
}
}
return resp;
}
示例2: canAccessLock
import com.liferay.portal.model.User; //导入依赖的package包/类
/**
* Comprueba si un usuario puede acceder a los cursos/modulos/actividades bloqueadas
* @param groupCreatedId id del grupo creado para el curso
* @param user usuario
* @return true en caso de que pueda acceder a bloqueados
*/
public boolean canAccessLock(long groupCreatedId, User user){
//Si es administrador
if(PortalUtil.isOmniadmin(user.getUserId())){
return true;
}
PermissionChecker permissionChecker = null;
try {
permissionChecker = PermissionCheckerFactoryUtil.create(user);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//Si tiene permiso ACCESSLOCK
if(permissionChecker != null && permissionChecker.hasPermission(groupCreatedId, "com.liferay.lms.model",groupCreatedId,"ACCESSLOCK")){
return true;
}
return false;
}
示例3: sendNotification
import com.liferay.portal.model.User; //导入依赖的package包/类
private void sendNotification(DDLRecord model, boolean newNotification) throws PortalException, SystemException {
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
jsonObject.put("model", model.getPrimaryKey());
jsonObject.put("title", (String) model.getFieldValue("Title"));
jsonObject.put("description", (String) model.getFieldValue("Description"));
jsonObject.put("newNotification", newNotification);
jsonObject.put("photo", (String) model.getFieldValue("Photo"));
//FIXME find by token instead of users
List<User> users = findSomeUsers(0, MAX_USERS);
long[] ids = getPrimaryKeysFromAList(users);
PushNotificationsDeviceLocalServiceUtil.sendPushNotification(ids, jsonObject);
}
示例4: createOrUpdateUser
import com.liferay.portal.model.User; //导入依赖的package包/类
@Override
public String createOrUpdateUser(long companyId, String emailAddress, String firstName, String lastName) {
try {
User user = UserLocalServiceUtil.fetchUserByEmailAddress(companyId, emailAddress);
if (user == null) {
LOG.debug("No Liferay user found with email address " + emailAddress + ", will create one.");
user = addUser(companyId, emailAddress, firstName, lastName);
} else {
LOG.debug("User found, updating name details with info from userinfo");
updateUser(user, firstName, lastName);
}
return String.valueOf(user.getUserId());
} catch (SystemException | PortalException e) {
throw new RuntimeException(e);
}
}
示例5: addDossierProcBookmark
import com.liferay.portal.model.User; //导入依赖的package包/类
/**
* Thêm mới bookmark thủ tục quan tâm
*
* Version: OEP 2.0
*
* History:
* DATE AUTHOR DESCRIPTION
* -------------------------------------------------
* 21-September-2015 trungdk Tạo mới
* @param serviceContext ngữ cảnh dịch vụ
* @return: đối tượng thủ tục quan tâm mới
*/
@Indexable(type = IndexableType.REINDEX)
public DossierProcBookmark addDossierProcBookmark(
long userId,
long dossierProcAgentId,
ServiceContext serviceContext) throws SystemException, PortalException {
long id = counterLocalService.increment();
DossierProcBookmark dossierProcBookmark = dossierProcBookmarkPersistence.create(id);
Date now = new Date();
User user = userPersistence.findByPrimaryKey(userId);
dossierProcBookmark.setCompanyId(user.getCompanyId());
dossierProcBookmark.setCreateDate(serviceContext.getCreateDate(now));
dossierProcBookmark.setGroupId(serviceContext.getScopeGroupId());
dossierProcBookmarkPersistence.update(dossierProcBookmark);
if (_log.isInfoEnabled()) {
_log.info("Create new dossier proc bookmark " + id);
}
return getDossierProcBookmark(id);
}
示例6: isLoggedInOrg
import com.liferay.portal.model.User; //导入依赖的package包/类
/**
* Checks if is logged in org.
*
* @param request the request
* @return true, if is logged in org
*/
protected boolean isLoggedInOrg(final PortletRequest request) {
boolean result = false;
final ThemeDisplay themeDisplay = (ThemeDisplay) request
.getAttribute(WebKeys.THEME_DISPLAY);
if (themeDisplay.isSignedIn()) {
final User user = themeDisplay.getUser();
if (user != null) {
try {
final List<Role> roles = user.getRoles();
final String orgRoleName = CustomPortalServiceHandler.getConfigValue(E_ConfigKey.ROLE_NAME_ORG);
for (final Role role : roles) {
if (role.getName().equals(orgRoleName)) {
result = true;
break;
}
}
} catch (final Throwable t) {
}
}
}
return result;
}
示例7: getRole
import com.liferay.portal.model.User; //导入依赖的package包/类
/**
* Gets the role.
*
* @param display the display
* @return the role
*/
protected E_Role getRole(final ThemeDisplay display) {
E_Role result = null;
final User user = display.getUser();
if (user != null && user.getEmailAddress() != null) {
List<Role> roles = null;
try {
roles = user.getRoles();
} catch (final SystemException e) {
}
if (roles != null) {
for (final Role role : roles) {
result = CustomPortalServiceHandler.matchesRole(role);
if (result != null) {
break;
}
}
}
}
return result;
}
示例8: changePassord
import com.liferay.portal.model.User; //导入依赖的package包/类
public void changePassord(ServiceContext serviceContext, User user, String password) throws Exception{
long companyId = serviceContext.getCompanyId();
Properties userMappings = getUserMappings(serviceContext.getCompanyId());
Binding binding = getUser(companyId, user.getScreenName());
System.out.println("bingging " + binding);
System.out.println("Pass " + user.getPassword());
String name = StringPool.BLANK;
StringBuilder sb = new StringBuilder();
LdapContext ctx = getContext(serviceContext.getCompanyId());
sb = new StringBuilder();
sb.append(userMappings.getProperty("screenName"));
sb.append(StringPool.EQUAL);
sb.append(user.getScreenName());
sb.append(StringPool.COMMA);
sb.append(getUsersDN(companyId));
name = sb.toString();
Modifications mods = Modifications.getInstance();
mods.addItem(userMappings.getProperty(UserConverterKeys.PASSWORD),password);
ModificationItem[] modItems = mods.getItems();
if (binding != null) {
ctx.modifyAttributes(name, modItems);
}
}
示例9: changeToShite
import com.liferay.portal.model.User; //导入依赖的package包/类
public void changeToShite(long workingUnitIdOld,long workingUnitId, User user) throws PortalException, SystemException{
WorkingUnit work = WorkingUnitLocalServiceUtil.getWorkingUnit(workingUnitId);
WorkingUnit workold = WorkingUnitLocalServiceUtil.getWorkingUnit(workingUnitIdOld);
long userId = user.getUserId();
//Group group = GroupLocalServiceUtil.getG(companyId, userId);
List<Group> groups = user.getGroups();
boolean f = false;
for (int i = 0; i < groups.size(); i++){
if (groups.get(i).getGroupId() == workold.getLocalSiteId() ){
f = true;
break;
}
}
if (work.getLocalSiteId() != workold.getLocalSiteId() || !f){
if (workold.getLocalSiteId() != PortletKeys.LONG_DEFAULT && f) {
GroupLocalServiceUtil.deleteUserGroup(userId,
workold.getLocalSiteId());
}
if (work.getLocalSiteId() != PortletKeys.LONG_DEFAULT) {
System.out.println(" changeToShite " + workingUnitId + " " + work.getLocalSiteId() + " " + userId);
GroupLocalServiceUtil.addUserGroup(userId,
work.getLocalSiteId());
System.out.println(" changeToShite " + workingUnitId + " " + work.getLocalSiteId() + " " + userId);
}
}
}
示例10: setParameterIntoResponse
import com.liferay.portal.model.User; //导入依赖的package包/类
private void setParameterIntoResponse(ActionResponse response,
Employee employee) throws PortalException, SystemException {
response.setRenderParameter(EmployeeKeys.AddEditAttributes.MAPPINGUSERID,String.valueOf(employee.getMappingUserId()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.WORKINGUNITID,String.valueOf(employee.getWorkingUnitId()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.MAINJOBPOSID,String.valueOf(employee.getMainJobPosId()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.EMPLOYEENO,String.valueOf(employee.getEmployeeNo()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.PERSONELDOCNO,String.valueOf(employee.getPersonelDocNo()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.FULLNAME,String.valueOf(employee.getFullName()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.GENDER,String.valueOf(employee.getGender()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.BIRTHDATE,String.valueOf(employee.getBirthdate()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.OFFICETEL,String.valueOf(employee.getOfficeTel()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.HOMETEL,String.valueOf(employee.getHomeTel()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.MOBILE,String.valueOf(employee.getMobile()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.EMAIL,String.valueOf(employee.getEmail()));
if (employee.getMappingUserId() > 0){
User user = UserLocalServiceUtil.getUser(employee.getMappingUserId());
response.setRenderParameter(EmployeeKeys.AddEditAttributes.SCREENNAME,String.valueOf(user.getScreenName()));
//response.setRenderParameter(EmployeeKeys.AddEditAttributes.PASSWORD,String.valueOf(user.getPassword()));
//response.setRenderParameter(EmployeeKeys.AddEditAttributes.REPASSWORD,String.valueOf(user.get()));
response.setRenderParameter(EmployeeKeys.AddEditAttributes.ISCREATUSER,String.valueOf(1));
}else {
response.setRenderParameter(EmployeeKeys.AddEditAttributes.ISCREATUSER,String.valueOf(0));
}
}
示例11: getAllEntities
import com.liferay.portal.model.User; //导入依赖的package包/类
public JSONArray getAllEntities() {
try {
PermissionChecker pc = getPermissionChecker();
long userId = pc.getUserId();
_log.debug("userId: " + userId);
_log.debug("pc.isSignedIn(): " + pc.isSignedIn());
_log.debug("getCompanyId: " + pc.getCompanyId());
User _user = userLocalService.fetchUser(userId);
_log.debug("_user.getFullName(): " + _user.getFullName());
_log.debug("_user.isActive(): " + _user.isActive());
_log.debug("_user.isAgreedToTermsOfUse(): " + _user.isAgreedToTermsOfUse());
_log.debug("_user.isEmailAddressVerified(): " + _user.isEmailAddressVerified());
_log.debug("_user.isLockout(): " + _user.isLockout());
_log.debug("_user.isNew(): " + _user.isNew());
} catch (PrincipalException pe) {
pe.printStackTrace();
} catch (SystemException se) {
se.printStackTrace();
}
return ogpd_EntityLocalService.getOGPD_Entities();
}
示例12: getRegionEntitiesForWidget
import com.liferay.portal.model.User; //导入依赖的package包/类
public JSONArray getRegionEntitiesForWidget(String regionID) {
try {
PermissionChecker pc = getPermissionChecker();
long userId = pc.getUserId();
_log.debug("userId: " + userId);
_log.debug("pc.isSignedIn(): " + pc.isSignedIn());
_log.debug("getCompanyId: " + pc.getCompanyId());
User _user = userLocalService.fetchUser(userId);
_log.debug("_user.getFullName(): " + _user.getFullName());
_log.debug("_user.isActive(): " + _user.isActive());
_log.debug("_user.isAgreedToTermsOfUse(): " + _user.isAgreedToTermsOfUse());
_log.debug("_user.isEmailAddressVerified(): " + _user.isEmailAddressVerified());
_log.debug("_user.isLockout(): " + _user.isLockout());
_log.debug("_user.isNew(): " + _user.isNew());
} catch (PrincipalException pe) {
pe.printStackTrace();
} catch (SystemException se) {
se.printStackTrace();
}
return ogpd_EntityLocalService.getRegionEntitiesForWidget(regionID);
}
示例13: doRun
import com.liferay.portal.model.User; //导入依赖的package包/类
public void doRun(long companyId) throws Exception {
LmsPrefs lmsPrefs=null;
try{
lmsPrefs=LmsPrefsLocalServiceUtil.getLmsPrefs(companyId);
}
catch(NoSuchPrefsException e){
lmsPrefs=null;
}
if(lmsPrefs==null){
createDefaultRoles(companyId);
createDefaultSiteTemplate(companyId);
createDefaultPreferences(companyId);
}
ExpandoTable table3 = getExpandoTable(companyId, User.class.getName(), ExpandoTableConstants.DEFAULT_TABLE_NAME);
if (table3 != null) {
createExpandoColumn(table3, "deregister-mail", ExpandoColumnConstants.BOOLEAN,
ExpandoColumnConstants.INDEX_TYPE_TEXT, ExpandoColumnConstants.PROPERTY_DISPLAY_TYPE_CHECKBOX, false, true);
}
}
示例14: getResult
import com.liferay.portal.model.User; //导入依赖的package包/类
public String getResult(long groupId){
String result ="";
try {
Course curso = CourseLocalServiceUtil.getCourseByGroupCreatedId(groupId);
User user = UserLocalServiceUtil.fetchUser(this.getUserId());
Locale locale = user.getLocale();
if(curso != null){
CalificationType ct = new CalificationTypeRegistry().getCalificationType(curso.getCalificationType());
result = ct.translate(locale,groupId, this.getResult());
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
示例15: getResult
import com.liferay.portal.model.User; //导入依赖的package包/类
public String getResult(long groupId){
String result ="";
try {
Course curso = CourseLocalServiceUtil.getCourseByGroupCreatedId(groupId);
User user = UserLocalServiceUtil.fetchUser(this.getUserId());
Locale locale = user.getLocale();
if(curso != null){
CalificationType ct = new CalificationTypeRegistry().getCalificationType(curso.getCalificationType());
result = ct.translate(locale, curso.getGroupCreatedId(),this.getResult());
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}