def POST(self): rtn = None try: if session.has_token() is False: anonymous_user = user.login(user.ANONYMOUS_ACCOUNT_NAME, None) session.set_token(anonymous_user) operation = user.get_operation(handler_class=self.get_qualified_name()) if operation is not None: paramnames = operation.get_resource_oql_paramnames() oqlparams = self._get_resource_oql_params(paramnames) if user.has_permission(self._get_user_id(), operation.operation_key, oqlparams=oqlparams): rtn = self.execute() else: if session.get_token().is_anonymous(): raise SessionExpiredError(session.get_token()) else: raise UnauthorizedError() else: raise CoreError("%s is not related to operation.", self.get_qualified_name()) except BaseException, e: msg = str(e) msg += traceback.format_exc() log.get_logger().error(msg) rtn = self._new_rtn(e=e).to_json()
def execute(self): rtn = self._new_rtn() session.drop_token() token = user.login(user.ANONYMOUS_ACCOUNT_NAME, None) token = session.set_token(token) rtn.set_data(token) return rtn.to_json()
def execute(self): rtn = self._new_rtn() login_name = self._get_str_parameter("loginName") login_pwd = self._get_str_parameter("loginPwd") token = user.login(login_name, login_pwd) token = session.set_token(token) rtn.set_data(token.to_dict()) return rtn.to_json()