org.sakaiproject.tool.api.Session.setUserEid()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(176)

本文整理了Java中org.sakaiproject.tool.api.Session.setUserEid()方法的一些代码示例,展示了Session.setUserEid()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Session.setUserEid()方法的具体详情如下:
包路径:org.sakaiproject.tool.api.Session
类名称:Session
方法名:setUserEid

Session.setUserEid介绍

[英]Set the enterprise id of the user associated with this session.
[中]设置与此会话关联的用户的企业id。

代码示例

代码示例来源:origin: sakaiproject/sakai

private void logIn() {
  Session sakaiSession = sessionManager.getCurrentSession();
  sakaiSession.setUserId("admin");
  sakaiSession.setUserEid("admin");
}

代码示例来源:origin: org.sakaiproject.samigo/samigo-services

private void logIn() {
  Session sakaiSession = sessionManager.getCurrentSession();
  sakaiSession.setUserId("admin");
  sakaiSession.setUserEid("admin");
}

代码示例来源:origin: sakaiproject/sakai

@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
  if (siteId == null) {
    siteId = UUID.randomUUID().toString();
  }
  log.info("Attempting to import: " + zip+ " into "+ siteId);
  Session currentSession = sessionManager.getCurrentSession();
  String oldId = currentSession.getUserId();
  String oldEid = currentSession.getUserEid();
  try {
    currentSession.setUserId("admin");
    currentSession.setUserEid("admin");
    archiveService.mergeFromZip(zip, siteId, null);
  } catch (Exception e) {
    log.warn("Failed to import " + zip + " to " + siteId + " " + e.getMessage());
  } finally {
    currentSession.setUserId(oldId);
    currentSession.setUserEid(oldEid);
  }
}

代码示例来源:origin: org.sakaiproject.scheduler/scheduler-component-shared

@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
  if (siteId == null) {
    siteId = UUID.randomUUID().toString();
  }
  log.info("Attempting to import: " + zip+ " into "+ siteId);
  Session currentSession = sessionManager.getCurrentSession();
  String oldId = currentSession.getUserId();
  String oldEid = currentSession.getUserEid();
  try {
    currentSession.setUserId("admin");
    currentSession.setUserEid("admin");
    archiveService.mergeFromZip(zip, siteId, null);
  } catch (Exception e) {
    log.warn("Failed to import " + zip + " to " + siteId + " " + e.getMessage());
  } finally {
    currentSession.setUserId(oldId);
    currentSession.setUserEid(oldEid);
  }
}

代码示例来源:origin: sakaiproject/sakai

public void execute(JobExecutionContext arg0) throws JobExecutionException {
    Session sakaiSession = sessionManager.getCurrentSession();
    sakaiSession.setUserId("admin");
    sakaiSession.setUserEid("admin");
    contentReviewService.processQueue();    
  }
}

代码示例来源:origin: org.sakaiproject/sakai-syllabus-impl

protected void loginToSakai() {
  Session sakaiSession = SessionManager.getCurrentSession();
  sakaiSession.setUserId(userId);
  sakaiSession.setUserEid(userId);
  // establish the user's session
  UsageSessionService.startSession(userId, "127.0.0.1", FixPublicSyllabusAttachmentsJob.class.getName());
  
  // update the user's externally provided realm definitions
  authzGroupService.refreshUser(userId);
  // post the login event
  EventTrackingService.post(EventTrackingService.newEvent(UsageSessionService.EVENT_LOGIN, null, true));
}

代码示例来源:origin: org.sakaiproject.metaobj/sakai-metaobj-impl

public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
  Session sakaiSession = SessionManager.getCurrentSession();
  String userId = sakaiSession.getUserId();
  String eId = sakaiSession.getUserEid();
  try {
    sakaiSession.setUserId("admin");
    sakaiSession.setUserEid("admin");
    boolean updateSchemaHashes = ServerConfigurationService.getBoolean("metaobj.schemahash.update", false);
    getStructuredArtifactDefinitionManager().verifySchemaHashes(updateSchemaHashes);
  } finally {
    sakaiSession.setUserEid(userId);
    sakaiSession.setUserId(eId);
  }
}

代码示例来源:origin: sakaiproject/sakai

session.setUserEid("admin");
session.setUserId("admin");
List<String> collection_ids = sqlService.dbRead(sql);

代码示例来源:origin: org.sakaiproject.scheduler/scheduler-component-shared

session.setUserEid("admin");
session.setUserId("admin");
List<String> collection_ids = sqlService.dbRead(sql);

代码示例来源:origin: sakaiproject/sakai

protected void loginToSakai() {
  Session sakaiSession = SessionManager.getCurrentSession();
  sakaiSession.setUserId("admin");
  sakaiSession.setUserEid("admin");
  // establish the user's session
  UsageSessionService.startSession("admin", "127.0.0.1", "CMSync");
  
  // update the user's externally provided realm definitions
  authzGroupService.refreshUser("admin");
  // post the login event
  EventTrackingService.post(EventTrackingService.newEvent(UsageSessionService.EVENT_LOGIN, null, true));
}

代码示例来源:origin: sakaiproject/sakai

private void loginToSakai() {
  Session sakaiSession = SessionManager.getCurrentSession();
  sakaiSession.setUserId("admin");
  sakaiSession.setUserEid("admin");
  // establish the user's session
  UsageSessionService.startSession("admin", "127.0.0.1", "CMSync");
  // update the user's externally provided realm definitions
  authzGroupService.refreshUser("admin");
  // post the login event
  EventTrackingService.post(EventTrackingService.newEvent(UsageSessionService.EVENT_LOGIN, null, true));
}

代码示例来源:origin: sakaiproject/sakai

session.setUserEid("admin");
session.setUserId("admin");

代码示例来源:origin: org.sakaiproject.scheduler/scheduler-component-shared

session.setUserEid("admin");
session.setUserId("admin");

代码示例来源:origin: sakaiproject/sakai

try {
  usr = org.sakaiproject.user.cover.UserDirectoryService.getUserByEid(user);
  requestSession.setUserEid(usr.getEid());
  requestSession.setUserId(usr.getId());
  requestSession.setActive();

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-api

try {
  usr = org.sakaiproject.user.cover.UserDirectoryService.getUserByEid(user);
  requestSession.setUserEid(usr.getEid());
  requestSession.setUserId(usr.getId());
  requestSession.setActive();

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

sakaiSession.setUserEid(eid);

代码示例来源:origin: sakaiproject/sakai

/**
 * <p>Login to sakai and start a user session. This users is intended
 * to be one of the 'hard wired' users; admin, postmaster, or synchrobot.</p>
 * <p>( this list of users can be extended; add the user via UI, update
 * the sakai_users table so their EID matches ID, add them to the
 * admin realm, restart )</p>
 * @param whoAs - who to log in as
 */
protected void loginToSakai(String whoAs) {
  
  serverName = ServerConfigurationService.getServerName();
  log.debug(" AutoSubmitAssessmentsJob Logging into Sakai on " + serverName + " as " + whoAs);
  UsageSession session = UsageSessionService.startSession(whoAs, serverName, "AutoSubmitAssessmentsJob");
  if (session == null)
  {
    EventTrackingService.post(EventTrackingService.newEvent(SamigoConstants.EVENT_AUTO_SUBMIT_JOB_ERROR, whoAs + " unable to log into " + serverName, true));
    return;
  }
  
  Session sakaiSession = SessionManager.getCurrentSession();
  sakaiSession.setUserId(whoAs);
  sakaiSession.setUserEid(whoAs);
  // update the user's externally provided realm definitions
  authzGroupService.refreshUser(whoAs);
  // post the login events
  EventTrackingService.post(EventTrackingService.newEvent(UsageSessionService.EVENT_LOGIN, whoAs + " running " + serverName, true));
}

代码示例来源:origin: org.sakaiproject.samigo/samigo-services

/**
 * <p>Login to sakai and start a user session. This users is intended
 * to be one of the 'hard wired' users; admin, postmaster, or synchrobot.</p>
 * <p>( this list of users can be extended; add the user via UI, update
 * the sakai_users table so their EID matches ID, add them to the
 * admin realm, restart )</p>
 * @param whoAs - who to log in as
 */
protected void loginToSakai(String whoAs) {
  
  serverName = ServerConfigurationService.getServerName();
  log.debug(" AutoSubmitAssessmentsJob Logging into Sakai on " + serverName + " as " + whoAs);
  UsageSession session = UsageSessionService.startSession(whoAs, serverName, "AutoSubmitAssessmentsJob");
  if (session == null)
  {
    EventTrackingService.post(EventTrackingService.newEvent(SamigoConstants.EVENT_AUTO_SUBMIT_JOB_ERROR, whoAs + " unable to log into " + serverName, true));
    return;
  }
  
  Session sakaiSession = SessionManager.getCurrentSession();
  sakaiSession.setUserId(whoAs);
  sakaiSession.setUserEid(whoAs);
  // update the user's externally provided realm definitions
  authzGroupService.refreshUser(whoAs);
  // post the login events
  EventTrackingService.post(EventTrackingService.newEvent(UsageSessionService.EVENT_LOGIN, whoAs + " running " + serverName, true));
}

代码示例来源:origin: sakaiproject/sakai

session.setUserEid("admin");
session.setUserId("admin");

代码示例来源:origin: org.sakaiproject.scheduler/scheduler-component-shared

session.setUserEid("admin");
session.setUserId("admin");

相关文章