예제 #1
0
	def create_session(self, session):
		Logger.info("SessionManagement::create %s for user %s"%(session.id, session.user.name))
		
		
		if System.userExist(session.user.name):
			Logger.error("unable to create session: user %s already exists"%(session.user.name))
			session.end_status = Session.SESSION_END_STATUS_ERROR
			self.aps_instance.session_switch_status(session, Session.SESSION_STATUS_ERROR)
			return self.destroy_session(session)
					
		rr = session.user.create()
		
		if rr is False:
			Logger.error("unable to create session for user %s"%(session.user.name))
			session.end_status = Session.SESSION_END_STATUS_ERROR
			self.aps_instance.session_switch_status(session, Session.SESSION_STATUS_ERROR)
			return self.destroy_session(session)
			
		
		session.user.created = True
					
		try:
			rr = session.install_client()
		except Exception,err:
			Logger.debug("Unable to initialize session %s: %s"%(session.id, str(err)))
			rr = False
예제 #2
0
    def create_session(self, session):
        Logger.info("SessionManagement::create %s for user %s" %
                    (session.id, session.user.name))

        if session.domain.manage_user():
            if System.userExist(session.user.name):
                Logger.error(
                    "unable to create session: user %s already exists" %
                    (session.user.name))
                session.end_status = Session.SESSION_END_STATUS_ERROR
                session.switch_status(Session.SESSION_STATUS_ERROR)
                return self.destroy_session(session)

            session.user.infos["groups"] = [
                self.aps_instance.ts_group_name,
                self.aps_instance.ovd_group_name
            ]

            if session.mode == "desktop":
                session.user.infos["shell"] = "OvdDesktop"
            else:
                session.user.infos["shell"] = "OvdRemoteApps"

            rr = session.user.create()
            if rr is False:
                Logger.error("unable to create session for user %s" %
                             (session.user.name))
                session.end_status = Session.SESSION_END_STATUS_ERROR
                session.switch_status(Session.SESSION_STATUS_ERROR)
                return self.destroy_session(session)

            session.user.created = True

            try:
                rr = session.install_client()
            except Exception:
                Logger.exception("Unable to initialize session %s" %
                                 session.id)
                rr = False

            if rr is False:
                Logger.error("unable to initialize session %s" % (session.id))
                session.end_status = Session.SESSION_END_STATUS_ERROR
                session.switch_status(Session.SESSION_STATUS_ERROR)
                return self.destroy_session(session)

        else:
            # will be customize by a lock system when the users will connect in RDP
            if not session.domain.onSessionCreate():
                session.end_status = Session.SESSION_END_STATUS_ERROR
                session.switch_status(Session.SESSION_STATUS_ERROR)
                return False

        session.post_install()

        session.switch_status(Session.SESSION_STATUS_INITED)
예제 #3
0
	def create_session(self, session):
		Logger.info("SessionManagement::create %s for user %s"%(session.id, session.user.name))
		
		if session.domain.manage_user():
			if System.userExist(session.user.name):
				Logger.error("unable to create session: user %s already exists"%(session.user.name))
				session.end_status = Session.SESSION_END_STATUS_ERROR
				session.switch_status(Session.SESSION_STATUS_ERROR)
				return self.destroy_session(session)
			
			session.user.infos["groups"] = [self.aps_instance.ts_group_name, self.aps_instance.ovd_group_name]
			
			if session.mode == "desktop":
				session.user.infos["shell"] = "OvdDesktop"
			else:
				session.user.infos["shell"] = "OvdRemoteApps"
			
			rr = session.user.create()
			if rr is False:
				Logger.error("unable to create session for user %s"%(session.user.name))
				session.end_status = Session.SESSION_END_STATUS_ERROR
				session.switch_status(Session.SESSION_STATUS_ERROR)
				return self.destroy_session(session)
			
			session.user.created = True
			
			try:
				rr = session.install_client()
			except Exception:
				Logger.exception("Unable to initialize session %s"%session.id)
				rr = False
			
			if rr is False:
				Logger.error("unable to initialize session %s"%(session.id))
				session.end_status = Session.SESSION_END_STATUS_ERROR
				session.switch_status(Session.SESSION_STATUS_ERROR)
				return self.destroy_session(session)
		
		else:
			# will be customize by a lock system when the users will connect in RDP
			if not session.domain.onSessionCreate():
				session.end_status = Session.SESSION_END_STATUS_ERROR
				session.switch_status(Session.SESSION_STATUS_ERROR)
				return False
		
		session.post_install()
		
		session.switch_status(Session.SESSION_STATUS_INITED)